Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

label_interactive

Create an interactive label


Description

This function returns an object that can be used as a label via the labs() family of functions or when setting a scale/guide name/title or key label. It passes the interactive parameters to a theme element created via element_text_interactive or via an interactive guide.

Usage

label_interactive(label, ...)

Arguments

label

The text for the label (scalar character)

...

any of the interactive_parameters().

Value

an interactive label object

See Also

Examples

library(ggplot2)
library(ggiraph)

gg_jitter <- ggplot(
  mpg, aes(cyl, hwy, group = cyl)) +
  geom_boxplot() +
  labs(title =
         label_interactive(
           "title",
           data_id = "id_title",
           onclick = "alert(\"title\")",
           tooltip = "title" )
  ) +
  theme(plot.title = element_text_interactive())

x <- girafe(ggobj = gg_jitter)
if( interactive() ) print(x)

ggiraph

Make 'ggplot2' Graphics Interactive

v0.7.10
GPL-3
Authors
David Gohel [aut, cre], Panagiotis Skintzos [aut], Mike Bostock [cph] (d3.js), Speros Kokenes [cph] (d3-lasso), Eric Shull [cph] (saveSvgAsPng js library), Eric Book [ctb] (hline and vline geoms)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.