R's ggplot2 package is a well-known tool for producing beautiful static data visualizations that you can include in a printed report. But what if you want to include a ggplot2 graphic on a webpage and provide the ability for the user to interact with the data? The ggiraph package by David Gohel (available for installation via CRAN). WIth ggiraph, you can take an existing ggplot2 bar chart, scatterplot, boxplot, map, or many other types of chart and add one or both of the following iteractions:
- Display a tooltip of your choice (e.g. data values or labels) when the cursor hovers over sections of the chart
The tweet below (from Duc Quang Nguyen, a data journalist at swissinfo.ch) shows an animation of ggiraph in action: a map of the net migration rate into (green) or out of (brown) regions in Europe.
Github (davidgohel): ggiraph