geom_text_interactive

0th

Percentile

add text with tooltips or click actions

tooltips can be displayed when mouse is over polygons, on click actions can be set with javascript instructions.

Usage
geom_text_interactive(mapping = NULL, data = NULL, stat = "identity", position = "identity", parse = FALSE, ..., nudge_x = 0, nudge_y = 0, check_overlap = FALSE, 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.
parse
See geom_point.
...
other arguments passed on to layer. See geom_point.
nudge_x, nudge_y
See geom_point.
check_overlap
See geom_point.
na.rm
See geom_point.
show.legend
See geom_point.
inherit.aes
See geom_point.
See Also

ggiraph

Aliases
  • geom_text_interactive
Examples
# add interactive polygons to a ggplot -------
## the data
dataset = mtcars
dataset$label = row.names(mtcars)

dataset$tooltip = paste0( "cyl: ", dataset$cyl, "<br/>",
       "gear: ", dataset$gear, "<br/>",
       "carb: ", dataset$carb)

## the plot
gg_text = ggplot(dataset,
                 aes(x = mpg, y = wt, label = label,
                     color = qsec,
                     tooltip = tooltip, data_id = label ) ) +
  geom_text_interactive() +
  coord_cartesian(xlim = c(0,50))

## display the plot
ggiraph(code = {print(gg_text)}, hover_css = "fill:#FF4C3B;font-style:italic;")
Documentation reproduced from package ggiraph, version 0.3.1, License: GPL-3

Community examples

Looks like there are no examples yet.