Reputation: 55
This is my list of plots that I want to arrange using grid.arrange.
p <- lapply(1:10, function(i) doPlot(comb_labels[1, i], comb_labels[2, i]))
The plots generated using doPlot respond to changes in brush and hover reactive variables in Shiny.
Apparantly, the brush and hover can only be declared with PlotOutput like:
plotOutput(plotname, height = 280, width = 250, hover = "plot_hover", brush = "plot_brush", click = "plot_click")
I would like to have the plots in a custom grid like this:
grid.arrange(p[[1]], ng, ng, ng,
p[[2]], p[[3]], ng, ng,
p[[4]], p[[5]], p[[6]] , ng,
p[[7]], p[[8]], p[[9]], p[[10]])
This returns an image without any dynamic elements.
How do I integrate the grid.arrange with PlotOutput or is there any alternative?
The format of my code looks like this: https://gist.github.com/wch/5436415
Upvotes: 3
Views: 4015
Reputation: 19793
Save value returned by grid.arrange
and then print
it:
output$shinyPlotObject <- renderPlot({
...
p = grid.arrange(p[[1]], ng, ng, ng,
p[[2]], p[[3]], ng, ng,
p[[4]], p[[5]], p[[6]] , ng,
p[[7]], p[[8]], p[[9]], p[[10]])
print(p)
}
Upvotes: 4