Display a ggplot2 or Base R plot as an interactive, accessible visualization
using the MAIDR (Multimodal Access and Interactive Data Representation) system.
Usage
show(plot = NULL, shiny = FALSE, as_widget = FALSE, ...)
Arguments
- plot
A ggplot2 object or NULL for Base R auto-detection
- shiny
If TRUE, returns just the SVG content instead of full HTML document
- as_widget
If TRUE, returns an htmlwidget object instead of opening in browser
- ...
Additional arguments passed to internal functions
Value
Invisible NULL. The plot is displayed in RStudio Viewer or browser as a side effect.
Examples
# ggplot2 example
library(ggplot2)
p <- ggplot(mtcars, aes(x = factor(cyl), y = mpg)) +
geom_bar(stat = "identity")
if (FALSE) { # \dontrun{
maidr::show(p)
} # }
# Base R example
if (FALSE) { # \dontrun{
barplot(c(10, 20, 30), names.arg = c("A", "B", "C"))
maidr::show()
} # }