Make 'ggplot2' Graphics Interactive

Create interactive 'ggplot2' graphics using 'htmlwidgets'.

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.6.1


  • new annotate_interactive function.


  • improving sizing with shiny.

ggiraph 0.6.0


  • The package is no more importing rvg and now need a compiler to install the package from source. The dsvg function will be then removed from rvg.

ggiraph 0.5.0


  • the package offers now new functions girafe() and girafe_options() to be used instead of function ggiraph(). It is more convenient to use when customization is needed.


  • add a 'download as png' button
  • usage of d3 version 5.7.0

Bug fixes

  • responsive behaviour when rendered in IE <= 12 is now fixed

ggiraph 0.4.4


  • new functions geom_sf_interactive

ggiraph 0.4.3


  • new functions geom_hline_interactive and geom_vline_interactive implemented by Eric Book.
  • all element with the same data_id are highlighted when mouse is over one of these elements.
  • ggproto GeomInteractive are exported.

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.7.10 by David Gohel, 5 months ago

Report a bug at

Browse source code at

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

Documentation:   PDF Manual  

GPL-3 license

Imports grid, ggplot2, htmlwidgets, stats, htmltools, Rcpp, systemfonts, purrr, rlang, uuid

Suggests knitr, testthat, rmarkdown, maps, shiny, sf, quantreg, xml2, dplyr

Linking to Rcpp, systemfonts

System requirements: C++11, libpng

Imported by devtoolbox, ggfacto, ggiraphExtra, microhaplot, vlda.

Suggested by ceterisParibus, eq5d, packcircles.

See at CRAN