Skip to contents

Build a widget payload from a ggplot object. The current implementation renders supported point, line, raster, and fixed-scale facet layouts through the browser WebGL path while keeping unsupported layers explicit in the payload.

Usage

ggplot_webgl(plot, width = NULL, height = NULL, elementId = NULL)

Arguments

plot

A ggplot object.

width, height

Optional widget dimensions.

elementId

Optional DOM element id.

Value

An htmlwidget.

Examples

plot <- ggplot2::ggplot(
  mtcars[1:10, ],
  ggplot2::aes(mpg, wt, colour = factor(cyl))
) +
  geom_point_webgl(size = 2) +
  theme_webgl(shader = "default")

ggplot_webgl(plot, width = 420, height = 320)