Skip to content

Instantly share code, notes, and snippets.

@trestletech
Created March 25, 2014 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trestletech/9765992 to your computer and use it in GitHub Desktop.
Save trestletech/9765992 to your computer and use it in GitHub Desktop.
ConditionalPanel + Plot Shiny Resizing Bug
library(shiny)
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
print("Plotting");
Sys.sleep(1)
# generate and plot an rnorm distribution with the requested
# number of observations
dist <- rnorm(input$obs)
hist(dist)
})
output$content <- renderTable({
data.frame(a=1:3, b=2:4)
})
})
library(shiny)
shinyUI(pageWithSidebar(
# Application title
headerPanel("New Application"),
# Sidebar with a slider input for number of observations
sidebarPanel(
conditionalPanel("1 == 1",
sliderInput("obs",
"Number of observations:",
min = 1,
max = 1000,
value = 500))
),
# Show a plot of the generated distribution
mainPanel(
tabsetPanel(
tabPanel("Tab1",
plotOutput("distPlot")
)
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment