% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/save_plot.R
\name{save_plot}
\alias{save_plot}
\title{Simple wrapper to ggsave}
\usage{
save_plot(filename, plot = last_plot(), saveBoth = FALSE, width = NA,
  height = NA, units = "in", scale = 1)
}
\arguments{
\item{filename}{string containing file name}

\item{plot}{which plot to save; by default, the last one created}

\item{saveBoth}{If TRUE, save both a .pdf and .png}

\item{width}{width of rendered plot}

\item{height}{height of the rendered plot}

\item{units}{units of the width/height of rendered plot (typically inches -- 'in')}

\item{scale}{scalar factor to enlarge/shrink the rendered plot}
}
\description{
Wrapper to ggsave to auto-save the annoying fiddly arguments I always forget. Works only w/ ggplot2 objects.
}
\examples{
# create a figure
p = ggplot(mtcars, aes(x = cyl, y = mpg)) + geom_point()
p + stat_summary(geom = 'point', fun.y = 'mean', colour = 'red', size = 5, shape = 21, fill = NA)

# save figures
save_plot('last_plot.pdf', width = 5, height = 5)
save_plot('plot_p.pdf', plot = p, width = 5, height = 5)

}
