Make 'ggplot2' Graphics Interactive

Create interactive 'ggplot2' graphics using 'htmlwidgets'.

Travis-CI BuildStatus Buildstatus version cranlogs Active

ggiraph is an htmlwidget and a ggplot2 extension. It allows ggplot graphics to be animated.

Animation is made with ggplot geometries that can understand three arguments:

  • tooltip: column of dataset that contains tooltips to be displayed when mouse is over elements.
  • onclick: column of dataset that contains javascript function to be executed when elements are clicked.
  • data_id: column of dataset that contains id to be associated with elements.

If used within a shiny application, elements associated with an id (data_id) can be selected and manipulated on client and server sides.


Get development version on github
Get CRAN version


ggiraph 0.4.2


  • ggiraph has a new argument dep_dir that controls the location of the output files.
  • deprecation of argument use_widget_size and flexdashboard. I hope this is the last mention to theses in the NEWS file.

ggiraph 0.4.1


  • argument flexdashboard and width are no more deprecated...
  • ggiraph gains a new argument use_widget_size that force usage of htmlwidget size and block the responsive behavior.

ggiraph 0.4.0


  • lasso selection has been implemented in Shiny context
  • a toolbar for zooming and selecting elements has been implemented.


  • zoom is disabled by default and can be activated via a button in the toolbar. It prevents scrooling issue (mouse over a zoomable svg steals scroll ability within the document).
  • ggiraph arguments flexdashboard and width are now deprecated and have no effects

ggiraph 0.3.3


  • widget sizing has been improved and ggiraph function gains new argument flexdashboard to make sure the graph fits available room.

Bug fixes

  • warnings did occur because some default_aes of ggproto were missing
  • slow zoom pan effect is now solved

ggiraph 0.3.2

New features

  • new geometry: geom_tile_interactive

Bug fixes

  • fix for element selection: svg elements with same id were not all selected but the only element that was clicked
  • fix css issues that occured when several ggiraph were on the same page and their tooltip did not share the same css attributes.


  • link to the online documentation.
  • usage of d3.js V4

ggiraph 0.3.1

New features

  • size management has been improved
  • there are 3 new geometries: geom_boxplot_interactive, geom_line_interactive and geom_bar_interactive.

Bug fixes

  • addCustomMessageHandler has to be called once to avoid a javascript exception
  • fix display issue in RStudio viewer for Windows

ggiraph 0.3.0


  • Allow zooming & panning to be turned off
  • clicked elements can now be tracked from shiny

ggiraph 0.2.0


  • Migration to d3.js
  • Update to htmlwidgets 0.6

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.4.3 by David Gohel, 15 days ago

Report a bug at

Browse source code at

Authors: David Gohel [aut, cre], Mike Bostock [cph] (d3.js), Speros Kokenes [cph] (d3-lasso), Eric Book [ctb] (hline and vline geoms)

Documentation:   PDF Manual  

GPL-3 license

Imports grid, ggplot2, htmlwidgets, stats, rvg, xml2, htmltools

Suggests knitr, rmarkdown, maps, shiny

Imported by ggiraphExtra.

Suggested by packcircles.

See at CRAN