ggiraph

Travis Build Status AppVeyor Build Status Coverage Status CRAN_Status_Badge

Make ‘ggplot’ Graphics Interactive

Overview

ggiraph is a tool that allows you to create dynamic ggplot graphs. This allows you to add tooltips, animations and JavaScript actions to the graphics.The package also allows the selection of graphical elements when used in shiny applications.

Under the hood, ggiraph is an htmlwidget and a ggplot2 extension. It allows graphics to be interactive, by exporting them as SVG documents and using special attributes on the various elements.

Interactivity is added to ggplot geometries, legends and theme elements, via the following aesthetics:

Why using ggiraph

Usage

With R and R Markdown

The things you need to know to create an interactive graphic :

library(ggplot2)
library(ggiraph)
data <- mtcars
data$carname <- row.names(data)

gg_point = ggplot(data = data) +
    geom_point_interactive(aes(x = wt, y = qsec, color = disp,
    tooltip = carname, data_id = carname)) + 
  theme_minimal()

girafe(ggobj = gg_point)

Usage within Shiny

Available interactive layers

They are several available interactive geometries. They are all based on their ggplot version, same goes for scales and the few guides: geom_point_interactive(), geom_col_interactive(), geom_tile_interactive(), scale_fill_manual_interactive(), scale_discrete_manual_interactive(), guide_legend_interactive(), …

Installation

Get development version on github

devtools::install_github('davidgohel/ggiraph')

Get CRAN version

install.packages("ggiraph")

Resources

Online documentation

The help pages are located at https://davidgohel.github.io/ggiraph.

Getting help

If you have questions about how to use the package, visit Stackoverflow and use tags ggiraph and r Stackoverflow link! I usually read them and answer when possible.

Contributing to the package

Bug reports

When you file a bug report, please spend some time making it easy for me to follow and reproduce. The more time you spend on making the bug report coherent, the more time I can dedicate to investigate the bug as opposed to the bug report.

Contributing to the package development

A great way to start is to contribute an example or improve the documentation.

If you want to submit a Pull Request to integrate functions of yours, provide if possible:

By using rhub (run rhub::check_for_cran()), you will see if everything is ok. When submitted, the PR will be evaluated automatically on travis and appveyor and you will be able to see if something broke.