| gf_girafe | R Documentation |
Converts a ggplot object with interactive elements into an interactive
HTML widget using ggiraph. This function is a wrapper around
ggiraph::girafe() tailored for ggformula interactive plots.
gf_girafe(ggobj, code, ...)
ggobj |
A ggplot object, typically created with a |
code |
R code to execute. This parameter is optional and rarely used in typical workflows. |
... |
Additional arguments passed to |
This function takes a ggplot object containing interactive elements
(created with gf_*_interactive() functions) and renders it as an
interactive plot. The resulting widget supports features like tooltips,
hover effects, and clickable elements.
An interactive HTML widget that can be displayed in RStudio Viewer, R Markdown documents, or Shiny applications.
ggiraph::girafe(), gf_point_interactive(), and other
gf_*_interactive() functions
library(ggformula)
# Basic interactive plot
gf_point_interactive(mpg ~ wt, data = mtcars,
tooltip = ~ paste("Car:", rownames(mtcars))) |>
gf_girafe()
# With custom sizing
gf_histogram_interactive(~ mpg, data = mtcars,
tooltip = ~ paste("Count:", after_stat(count))) |>
gf_girafe(width_svg = 8, height_svg = 6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.