Here is a code example, also temporarily available here
https://alvarosg.shinyapps.io/temp
library(shiny)
ui <- fluidPage(
textInput(inputId = "error", label = "St. Dev. error bars", value = "0.1"),
actionButton(inputId = "run", label = "Make me a plot"),
plotOutput("plot")
)
server <- function(input, output, session) {
observeEvent(input$run, {
output$plot <- renderPlot({
n <- 40
e <- abs(rnorm(n,0,as.numeric(input$error))) + 0.001
plot(seq(n),rep(0,n), type = 'p', pch = 20, xlab = "", ylab = "", xlim = NULL, ylim = NULL)
polygon(c(seq(n),rev(seq(n))),c(e,rev(-e)),col = rgb(0,0,0,0.2),border = NA)
})
})
}
shinyApp(ui, server)
After playing around with this example, I realized that when the error bars are too large, the polygon is not drawn locally, but it still does on shinyapps. Check this by setting the error bar sd at 0.5 and iterate.
The error bars size may not be the full story, because in my shiny app the user can zoom in/out the series and the polygon is never visible, whereas in shinyapps it is.