Learn R Programming

maidr (version 0.1.2)

save_html: Save Interactive Plot as HTML File

Description

Save a ggplot2 or Base R plot as a standalone HTML file with interactive MAIDR accessibility features.

Usage

save_html(plot = NULL, file = "plot.html", ...)

Value

The file path where the HTML was saved (invisibly)

Arguments

plot

A ggplot2 object or NULL for Base R auto-detection

file

File path where to save the HTML file (e.g., "plot.html")

...

Additional arguments passed to internal functions

Examples

Run this code
# ggplot2 example
library(ggplot2)
p <- ggplot(mtcars, aes(x = factor(cyl), y = mpg)) +
  geom_bar(stat = "identity")
# \donttest{
maidr::save_html(p, tempfile(fileext = ".html"))
# }

# Base R example (requires interactive session for function patching)
if (interactive()) {
  barplot(c(10, 20, 30), names.arg = c("A", "B", "C"))
  maidr::save_html(file = tempfile(fileext = ".html"))
}

Run the code above in your browser using DataLab