% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/save_plot.R
\name{save_bayesqm_plot}
\alias{save_bayesqm_plot}
\title{Save a bayesqm plot to file}
\usage{
save_bayesqm_plot(file, expr, width = 7.2, height = 5, dpi = 300)
}
\arguments{
\item{file}{Output path. Extension determines the device.}

\item{expr}{Plotting expression (lazily evaluated).}

\item{width, height}{Dimensions in inches. Defaults to a 7.2 x 5
inch two-column journal figure.}

\item{dpi}{Resolution for raster formats (\code{png}, \code{tiff}, \code{jpeg}).}
}
\value{
The \code{file} path, invisibly.
}
\description{
Opens a graphics device chosen from the file extension (\code{.pdf},
\code{.svg}, \code{.png}, \code{.tiff}, \code{.jpeg}), evaluates \code{expr} so whatever it
draws lands on that device, and closes the device. \code{expr} is lazily
evaluated, so a call like \code{save_bayesqm_plot("fig.pdf", plot(fit))}
does not draw to the current screen device first. If \code{expr} returns
a \code{ggplot} object (for example, from \code{\link[ggplot2:autoplot]{ggplot2::autoplot()}}), it is
\code{print()}ed onto the device.
}
\examples{
f <- file.path(tempdir(), "fig.pdf")
save_bayesqm_plot(f, plot(1:10))
unlink(f)

}
