Learn R Programming

ggiraph (version 0.6.1)

annotate_interactive: interactive annotations

Description

Create interactive annotations, similar to ggplot2 annotate.

Usage

annotate_interactive(geom, x = NULL, y = NULL, xmin = NULL,
  xmax = NULL, ymin = NULL, ymax = NULL, xend = NULL,
  yend = NULL, ..., na.rm = FALSE)

Arguments

geom

name of geom to use for annotation

x

positioning aesthetics - you must specify at least one of these.

y

positioning aesthetics - you must specify at least one of these.

xmin

positioning aesthetics - you must specify at least one of these.

xmax

positioning aesthetics - you must specify at least one of these.

ymin

positioning aesthetics - you must specify at least one of these.

ymax

positioning aesthetics - you must specify at least one of these.

xend

positioning aesthetics - you must specify at least one of these.

yend

positioning aesthetics - you must specify at least one of these.

...

Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat.

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

See Also

ggiraph

Examples

Run this code
# NOT RUN {
library(ggplot2)
library(ggiraph)

gg <- ggplot(mtcars, aes(x = disp, y = qsec )) +
  geom_point(size=2) +
  annotate_interactive(
    "rect", xmin = 100, xmax = 400, fill = "red",
    data_id = "an_id", tooltip = "a tooltip",
    ymin = 18, ymax = 20, alpha = .5)

x <- girafe(ggobj = gg, width_svg = 5, height_svg = 4)
if( interactive() ) print(x)
# }

Run the code above in your browser using DataLab