grattan_save_web.RdA wrapper around grattan_save() that saves a chart as a PNG
using the "slide" font (Avenir Next / DM Serif Display) for web-ready
output. No PowerPoint or data files are created, and no subdirectory is
created.
grattan_save_web(
filename,
object = ggplot2::last_plot(),
type = "normal",
font = "slide",
no_new_folder = FALSE,
...
)Filename for the chart. Must end in .png
(the extension is added automatically if missing; an error is thrown if a
different extension is supplied).
A ggplot object. Defaults to the last plot created.
Chart type - see ?grattan_save for options. Defaults to
"normal". All valid grattan_save() types are supported.
Default is "slide", appropriate for web purposes.
Default is FALSE, meaning the chart is
saved in a new subdirectory named after filename. If TRUE,
no subdirectory is created.
Additional arguments passed to grattan_save(), such as
height, dpi, force_labs, etc.
Default labelling behaviour for the chosen type is
preserved: grattan_save_web() does not force labels on or off.
if (FALSE) { # \dontrun{
library(ggplot2)
p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_grattan() +
labs(title = "Web-ready chart",
subtitle = "Saved as a PNG with the slide font",
caption = "Source: mtcars")
grattan_save_web("my_chart.png", p, type = "blog")
} # }