plot_save: Save plots using ggsave but with some default arguments...

View source: R/plot_save.R

plot_saveR Documentation

Save plots using ggsave but with some default arguments sorted

Description

Save plots using ggsave but with some default arguments sorted

Usage

plot_save(
  plot = ggplot2::last_plot(),
  dir,
  height = 6,
  width = 8,
  dpi = 320,
  units = c("in", "cm", "mm", "px")
)

Arguments

plot

Which plot to save? Either an object or default to the last_plot()

dir

What should the plot be saved as, and where?

height

Plot's height (default in inches)

width

Plot's width (default in inches)

dpi

Resolution

units

Measurement unit e.g. "in" = inches

Value

Saves a plot in the appropriate directory

Examples

## Not run: 
mtcars %>%
  ggplot(aes(x= cyl, y = mpg)) +
  geom_point()

plot_save("viz/imaginary_plot.png", dpi = 700)

## End(Not run)

jpcompartir/JPackage documentation built on March 20, 2023, 4 a.m.