Skip to contents

This function save a plot to a provided path.

Usage

save_plot(p, path = NULL, width = 7/5, height = 7/4, ...)

Arguments

p

ggplot. A plot.

path

Character. Path to save the image.

width

Numeric. Width of the image.

height

Numeric. Height of the image.

...

Other arguments passed to ggplot2::ggsave().

Value

The image path.

Examples

p <- ggplot2::ggplot(cars) + ggplot2::geom_point(ggplot2::aes(dist, speed))
save_plot(p)
#> [1] "/var/folders/61/bv7_1qzs20x6fjb2rsv7513r0000gn/T//RtmpJlqIGX/file1157a52a586a4.png"