save_plot: Save a ggplot and output a path suitable for an extarnal...

Description Usage Arguments Value Examples

View source: R/save_plot.R

Description

Save a ggplot and output a path suitable for an extarnal targets file

Usage

1
save_plot(path, plot)

Arguments

path

A path where to save the plot.

plot

An object of class "ggplot".

Value

A character string.

Examples

1
2
3
4
5
6
7
8
9
library(ggplot2)

plot <- ggplot(airquality, aes(Ozone, Day)) +
  geom_smooth(method = "lm")
path <- tempfile(fileext = ".png")
out <- save_plot(path, plot)
out

file.exists(out)

2DegreesInvesting/ds.targets documentation built on March 13, 2021, 1:46 p.m.