ggsave2: Save and open plot

View source: R/plot-save-render.R

ggsave2R Documentation

Save and open plot

Description

Wrapper around ggplot2::ggsave() that opens rendered output using the system's default app for the graphic type.

Usage

ggsave2(..., load_as_magick = FALSE)

Arguments

...

Passed to ggplot2::ggsave(), with some defaults optimized for publication figures.

load_as_magick

Whether to show information about the saved plot and invisibly return an ImageMagick object of the plot for post-processing. Defaults to FALSE.

Default options for publication figures

width

Defaults to 5.2in, 80% of the full-width of letter-sized paper (8.5in) minus 1in margins. Accepts a string of percentage scale (ex: "50%").

height

Defaults to 3in, 33% of the full-width of letter-sized paper (11in) minus 1in margins. Accepts a string of percentage scale (ex: "50%").

If either width or height are specified as percentages, the following defaults are also set:

dpi

300, the print standard.

units

"in"

Examples

## Not run: 
# p <- ggplot2::qplot(mpg, hp, data = mtcars)
# ggplot2::ggsave2("myplot.png", p, width = "50%", height = "30%")

## End(Not run)

yjunechoe/penngradlings documentation built on Sept. 6, 2024, 8:13 p.m.