is.gg: Check if an object is a ggplot or gtable

View source: R/isgg.R

is.ggR Documentation

Check if an object is a ggplot or gtable

Description

This function tests whether an object is a ggplot2 plot object or a gtable (grid table) object.

Usage

is.gg(x)

Arguments

x

An object to test

Value

Logical. TRUE if x inherits from "ggplot" or "gtable", FALSE otherwise.

Examples

## Not run: 
library(ggplot2)
p <- ggplot(mtcars, aes(x = mpg, y = hp)) + geom_point()
is.gg(p)  # TRUE
is.gg(mtcars)  # FALSE

## End(Not run)


tracee documentation built on Nov. 24, 2026, 5:07 p.m.