gf_girafe: Render interactive ggformula plots

View source: R/ggiraph.R

gf_girafeR Documentation

Render interactive ggformula plots

Description

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.

Usage

gf_girafe(ggobj, code, ...)

Arguments

ggobj

A ggplot object, typically created with a ⁠gf_*_interactive()⁠ function.

code

R code to execute. This parameter is optional and rarely used in typical workflows.

...

Additional arguments passed to ggiraph::girafe(), such as width_svg, height_svg, options, etc.

Details

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.

Value

An interactive HTML widget that can be displayed in RStudio Viewer, R Markdown documents, or Shiny applications.

See Also

ggiraph::girafe(), gf_point_interactive(), and other ⁠gf_*_interactive()⁠ functions

Examples

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)


ggformula documentation built on Jan. 17, 2026, 9:06 a.m.