
Last chance! 50% off unlimited learning
Sale ends in
The layer is based on annotation_raster()
.
See the documentation for that function for more details.
annotation_raster_interactive(...)
arguments passed to base function, plus any of the interactive_parameters.
The interactive parameters can be supplied as arguments in the relevant function and they can be scalar values or vectors depending on params on base function.
girafe()
# add interactive raster annotation to a ggplot -------
library(ggplot2)
library(ggiraph)
# Generate data
rainbow <- matrix(hcl(seq(0, 360, length.out = 50 * 50), 80, 70), nrow = 50)
p <- ggplot(mtcars, aes(mpg, wt)) +
geom_point() +
annotation_raster_interactive(rainbow, 15, 20, 3, 4, tooltip = "I am an image!")
x <- girafe(ggobj = p)
if( interactive() ) print(x)
# To fill up whole plot
p <- ggplot(mtcars, aes(mpg, wt)) +
annotation_raster_interactive(rainbow, -Inf, Inf, -Inf, Inf, tooltip = "I am an image too!") +
geom_point()
x <- girafe(ggobj = p)
if( interactive() ) print(x)
Run the code above in your browser using DataLab