% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lapop_save.R
\name{lapop_save}
\alias{lapop_save}
\title{LAPOP Save}
\usage{
lapop_save(
  figure,
  filename,
  format = "svg",
  logo = FALSE,
  width_px = 895,
  height_px = 500
)
}
\arguments{
\item{figure}{Ggplot object.}

\item{filename}{File path + name to be saved + .filetype.}

\item{format}{Character.  Options: "png", "svg". Default = "svg".}

\item{logo}{Logical.  Should logo be added to plot?  Default: FALSE.}

\item{width_px}{Numeric. Width in pixels.  Default: 750.}

\item{height_px}{Numeric.  Height in pixels.}
}
\value{
Saves a file (in either .svg or .png format) to provided directory.
}
\description{
This function creates exports graphs created using the LAPOP templates.
}
\examples{
\donttest{df <- data.frame(
cat = c("Far Left", 1, 2, 3, 4, "Center", 6, 7, 8, 9, "Far Right"),
prop = c(4, 3, 5, 12, 17, 23, 15, 11, 5, 4, 1),
proplabel = c("4\%", "3\%", "5\%", "12\%", "17\%", "23\%", "15\%", "11\%", "5\%", "4\%", "1\%")
)
myfigure <- lapop_hist(df,
          main_title = "Centrists are a plurality among Peruvians",
          subtitle = "Distribution of ideological preferences",
          source_info = "Peru, 2019",
          ymax = 27
)

f <- file.path(tempdir(), "fig1.svg")
lapop_save(myfigure, f, format = "svg", width_px = 800)
}
}
