geom_point_interactive
From ggiraph v0.3.1
by David Gohel
add points with tooltips or click actions for a scatterplot
The point_interactive geom is used to create interactive scatterplots, tooltips can be displayed when mouse is over points, on click actions can be set with javascript instructions.
Usage
geom_point_interactive(mapping = NULL, data = NULL, stat = "identity", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
Arguments
- mapping
- The aesthetic mapping, see
geom_point
. - data
- A data frame, see
geom_point
. - stat
- The statistical transformation to use on the data for this
layer, as a string, see
geom_point
. - position
- Postion adjustment, see
geom_point
. - na.rm
- See
geom_point
. - show.legend
- See
geom_point
. - inherit.aes
- See
geom_point
. - ...
- other arguments passed on to layer. See
geom_point
.
See Also
Examples
# add interactive points to a ggplot -------
# 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)})
Community examples
Looks like there are no examples yet.