I have an output plot that is dependent on a reactive function called datasetInput
. Whenever I change the input variable the output function updates, but the plot I see on the client does not end up changing. I output the data used by ggplot to generate the plot and the data is changing. I'm not sure whats going on.
datasetInput <- reactive({
data <- input$globalData
table <- c()
...
table
})
output$plot <- renderPlot({
table <- datasetInput()
cat('32hr: ',unlist(table[which(table$group=='32hr'),3]),'\n')
cat('24hr: ',unlist(table[which(table$group=='24hr'),3]),'\n')
range <- max(table$centroidDistances.RG) - min(table$centroidDistances.RG)
cat('range: ',range,'\n')
plot <- ggplot(table,aes(x=table$centroidDistances.RG,fill=table$group)) +
geom_histogram(aes(y=..density..),pos="dodge") +
geom_density(alpha=0.2)
print(plot)
},height=300,width=600)
I have not seen this problem before, how can I get the client to change its output when output$plot
changes (is this a specific problem to ggplot?)
cat
statements is interfering with therenderPlot
plot output. Can you move them outside of the statement and see if the plot changes? Also, I was not aware you could callheight
andweight
outside of the curly braces. I thought you had to close a reactive output with})
? - intra