2017-01-18 4 views
1

unter Mainpanel Grafik erscheinen Ich habe eine glänzende app unter Verwendung eines Fluidrastersystem erzeugt (d.h. unter Verwendung fluidPage), die verwendet sidebarPanel und tabsetPanel. Zusätzlich zu den Eingabe "Kontrolle" -Widgets, die ich in die Seitenleiste einfüge, möchte ich auch eine Reihe von Eingabe-Widgets hinzufügen unter die Grafik in meinem Hauptfenster auf einem bestimmten Panel.fluidRow wird nicht im glänzenden

Mein Ansatz war einfach eine fluidRow mit mehreren Spalten nach dem plotOutput Befehl in der ersten tabPanel enthalten.

Mein Code produziert keine Fehler, aber aus irgendeinem Grund nichts zeigt sich unter der Grafik in meinem Hauptfenster.

Ist das nicht möglich, oder mache ich etwas falsch?

Hinweis: diese SO question schlägt vor, dass mein Ansatz zum Einschließen mehrerer UI-Elemente innerhalb der Registerkarte gültig ist, und diese SO question schlägt vor, dass mehrere Ausgänge zum mainPanel hinzugefügt werden können (aber was ist mit Eingaben ??). Also was gibt ??

Beispielcode mit dem gleichen Problem:

library(shiny) 

ui <- fluidPage(

    titlePanel(
    h1("NMS Comparing tool", style = "font-size: 15px") 
), 


    sidebarPanel(width = 3, 
      div(style = "font-size: 8px;", 
       sliderInput(inputId = "groups", 
          label = "No. of Groups", 
          value = 4, min = 2, max = 12) 
      ), 

      fluidRow(
      column(6,offset=0, 
        div(style = "height: 105px; padding: 0px 0px", 
         plotOutput(outputId = "scree") 
        ) 
      ), 

      column(6,offset=0, 
        div(style = "font-size: 8px;padding: 0px 10px;height: 105px", 
         checkboxGroupInput(inputId = "labels", 
              label = "Labels", 
              choices = c("SPEC","Plot-End","Plot-Start"), 
              selected = c("SPEC","Plot-End","Plot-Start") 
         )  
        ) 
      ) 
      ), 

      fluidRow(
      column(6,offset=0, 
        div(style = "font-size: 8px; padding: 0px 0px",  
         radioButtons(inputId = "data", 
            label = "Data", 
            choices = c("PSP Only","PSP + MAP"), 
            selected = "PSP + MAP") 
        )  
      ), 

      column(6,offset=0, 
        div(style = "font-size: 8px;padding: 0px 10px;", 
         radioButtons(inputId = "freq", 
            label = "Frequency", 
            choices = c(0.025,0.05), 
            selected = 0.05) 
        ) 
      ) 
      ), 

      fluidRow(
      column(6,offset=0, 
        div(style = "font-size: 8px; padding: 0px 0px; ",     
         radioButtons(inputId = "arrows", 
            label = "Vector Choice", 
            choices = c("Cumulative Change","All Samples","Hurricane"), 
            selected = "Cumulative Change") 
        ) 
      ), 

      column(6,offset=0, 
        div(style = "font-size: 8px;padding: 0px 10px",  
         selectInput(inputId = "size", 
            label = "Tree Size", 
            choices = c("All","Canopy","Subcanopy","Small"), 
            selected = "All"), 
         tags$style(type = "text/css", 
            "#size {height: 4px; }") 
        ) 
      ) 
      ), 

      fluidRow(
      div(style = "font-size: 8px;",     
       verbatimTextOutput("info") 
      )  
      ) 
      , 

      mainPanel(width = 9, 
        tabsetPanel(
         tabPanel(title = "NMS", 
           plotOutput(outputId = "nms", click = "plot_click"), 
           fluidRow(
            column(2,offset=0, 
             div(style = "font-size: 8px; padding: 0px 0px", 
              actionButton(inputId = "plot.singles", label = "Lookup") 
             ) 
           ), 
            column(2,offset=0, 
             div(style = "font-size: 8px; padding: 0px 0px",  
              textInput(inputId = "individ", label = "Plot(s)") 
             ) 
           ), 
            column(2,offset=0, 
             div(style = "font-size: 8px; padding: 0px 0px", 
              textInput(inputId = "group.choose", label = "Group(s)") 
             ) 
           ), 
            column(3,offset=0, 
             div(style = "font-size: 8px; padding: 0px 0px", 
              sliderInput(inputId = "lwidth.choose", label = "LineWidth",min = 1, max = 6) 
             ) 
           ) 
           ) 
         ), 
         tabPanel(title = "Silhouette", plotOutput(outputId = "silhouette")), 
         tabPanel(title = "Indicator Spp", dataTableOutput(outputId = "ind.spp")), 
         tabPanel(title = "Data", dataTableOutput(outputId = "nms.data.table")) 
        ) 
      ) 
) 
) 


server <- function(input, output) { 

output$scree <- renderPlot({ 

    par(mar = c(1.5,1.4,0.1,0.1), mgp = c(0.5,0.01,0), tcl = -0.1) 
    plot(runif(99),runif(99),cex.axis=0.5,cex.lab=0.5,cex=0.75) 

    },height = 95, width = 135) 

    output$nms <- renderPlot({ 

    plot(runif(99),runif(99)) 

    }) 

} 

shinyApp(ui = ui, server = server) 
+0

War deine Silhouette Handlung arbeiten. Ich bekomme eine leere Handlung, ohne Cluster, nur Text – vipin8169

+0

@ vipin8169 Leider habe ich noch nie Silhouette Plots zu arbeiten bekommen. Sie kommen mir auch immer leer vor. Ich begrüße Sie, um eine Frage zu diesem – theforestecologist

Antwort

3

Sicherlich, was Sie versuchen ist möglich zu tun. Wenn ich Ihren Beispielcode ausführe, sehe ich tatsächlich die Widgets unter dem Plot (Suche, Plot (s), Gruppe (n), usw.). Aber ich musste zuerst ein paar kleine Dinge reparieren - zum einen müssen Sie sliderInput einen Wert angeben. Zum anderen haben Sie eine falsch platzierte Klammer, die dazu führt, dass die mainPanel in Ihre sidebarPanel geschoben wird.

Aber es gibt kein Problem mit Ihrem fluidRow selbst, wie geschrieben. Stellen Sie sicher, dass Sie es an der richtigen Stelle in der Benutzeroberfläche platziert haben.

+0

oops zu öffnen. Das wird es tun! Manchmal braucht es nur dieses frische Augenpaar: p. Vielen Dank. – theforestecologist

Verwandte Themen