Skip to contents

Drop all data in the plot (only one observation is kept)

Usage

drop_data(p)

# S3 method for ggplot
drop_data(p)

# S3 method for patchwork
drop_data(p)

# S3 method for default
drop_data(p)

Arguments

p

A patchwork object.

Examples

library(ggplot2)
p <- ggplot(data = mtcars, aes(x = mpg, y = wt, colour = cyl)) +
  geom_point() +
  scale_x_continuous(limits = c(10, 30)) +
  scale_y_continuous(limits = c(1, 6)) +
  theme_scp()
object.size(p)
#> 39064 bytes

p_drop <- drop_data(p)
object.size(p_drop)
#> 34016 bytes

p / p_drop
#> Warning: Removed 4 rows containing missing values (`geom_point()`).