This package allows us to add panning and zooming to any R graphics, e.g. base, ggplot2, lattice. To install t
install.packages("svgPanZoom") install.packages("svglite") # Needed for base
To install the development version use
devtools::install_github("timelyportfolio/svgPanZoom")
Load the package in the usual way
library("svgPanZoom") library("svglite")## For base
Then just wrap a base graphic function call
svgPanZoom( svglite:::inlineSVG( plot(1:10) ), controlIconsEnabled = TRUE )
ggplot2
is just as easy
library("ggplot2") data(mtcars, package = "datasets") d = ggplot(mtcars, aes(mpg, disp, colour = disp)) + geom_jitter() + theme_bw() svgPanZoom(d, controlIconsEnabled = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.