Hi my second week with shiny. I'm coding an app, where a plot window and some plot control buttons needs to appear at some point. I use renderUI() and renderPlot(). I can have the user to update plot parameters renderPlot(expr={ [inside here] }).
,but I cannot have the user to change the plot resolution renderPlot(res=[some reactive variable outside here],expr={ })
I have posted test example below, Thanks alot.
library(shiny)
ui = fluidPage(
uiOutput('thisPlot'),
uiOutput('plotOptions')
)
server <- function(input, output) {
#some plot options which will appear by some event
output$plotOptions <- renderUI({
if(TRUE) {list(
radioButtons('plot.log', 'log axis',
c('none'= '' ,
'x' = 'x',
'y' = 'y',
'xy' = 'xy'),sel=NULL),
sliderInput('plotRes', "resolution",min=50,max=200,value=75)
)}
})
#render plot // plotRes does not respond
output$thisGraphicsDev <- renderPlot(res=input$plotRes,expr={
plot(x=runif(1000),y=runif(1000),log=input$plot.log)
})
#write plot to ui
output$thisPlot <- renderUI({plotOutput('thisGraphicsDev')})
}
shinyApp(ui, server)