% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/save_functions.R
\name{save_plot}
\alias{save_plot}
\title{Save a single plot}
\usage{
save_plot(
  plot,
  filename = "plot",
  format = c("png", "pdf", "jpg"),
  width = 8,
  height = 6,
  dpi = 300
)
}
\arguments{
\item{plot}{A \code{ggplot2} object.}

\item{filename}{Name of the file to save, with or without extension. If no
directory is supplied, the file is saved in \code{tempdir()}.}

\item{format}{Output format. One of \code{"png"}, \code{"pdf"}, or \code{"jpg"}.}

\item{width}{Width of the saved plot in inches.}

\item{height}{Height of the saved plot in inches.}

\item{dpi}{Resolution of the plot in dots per inch.}
}
\value{
Saves the file to disk. Invisibly returns the normalized file path.
}
\description{
Saves a \code{ggplot2} plot to a file in PNG, PDF, or JPG format.
}
\examples{
p <- ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) +
  ggplot2::geom_point()

save_plot(p, filename = tempfile("plot"), format = "png")
}
