
Last chance! 50% off unlimited learning
Sale ends in
Use geom_zzz_interactive
to create interactive graphical elements.
Difference from original functions is that the following
aesthetics are understood: tooltip
, onclick
and data_id
.
Tooltips can be displayed when mouse is over graphical elements. On click actions can be set with javascript instructions. If id are associated with points, they get animated when mouse is over and can be selected when used in shiny apps.
ggiraph(code, ggobj = NULL, pointsize = 12, width = 0.7, width_svg = 6, height_svg = 6, tooltip_extra_css, hover_css, tooltip_opacity = 0.9, tooltip_offx = 10, tooltip_offy = 0, zoom_max = 1, selection_type = "multiple", selected_css, ...)
code
will
be ignored if this argument is supplied.position: absolute;pointer-events: none;
)
used to customize tooltip area.dsvg
# ggiraph simple example -------
# create dataset
dataset = iris
dataset$tooltip = dataset$Species
dataset$clickjs = paste0("alert(\"",dataset$Species, "\")" )
# plots
gg_point = ggplot(dataset, aes(x = Sepal.Length, y = Petal.Width,
color = Species, tooltip = tooltip, onclick = clickjs) ) +
geom_point_interactive()
ggiraph(code = {print(gg_point)})
Run the code above in your browser using DataLab