Search code examples
rplottooltipshinymouseover

How to show a plot in a tooltip with Shiny


I'm building a Shiny app using ggvis, and I need to show a plot (a bar chart, for example) in a tooltip.

So basically, when a user clicks one of the points in the main plot I want a tooltip (or something of the sort) to display a new plot with extra information.

Is it possible to do this with Shiny?


Solution

  • The shiny demo at: http://shiny.rstudio.com/gallery/plot-interaction-selecting-points.html shows code where clicking on (or near) a point produces text output, you could modify that to create the second graph instead. I don't know how to do it like a tool tip, but this would produce the graph next to, or just below the graph being clicked on. The example uses ggplot2 rather than ggvis, so I don't know how that would change things.