| dmai_save | R Documentation |
A wrapper of ggsave with the defaults of the package: a vector PDF through
cairo_pdf (embedded fonts, correct glyphs), A4 landscape (11.69 x 8.27 inches) and 600
dpi for raster formats. The device follows the file extension for other formats (.png, .svg,
.tiff, ...).
dmai_save(
plot = ggplot2::last_plot(),
filename,
path = NULL,
width = 11.69,
height = 8.27,
units = c("in", "cm", "mm"),
dpi = 600,
scale = 1,
device = NULL,
limitsize = TRUE,
...
)
## Default S3 method:
dmai_save(
plot = ggplot2::last_plot(),
filename,
path = NULL,
width = 11.69,
height = 8.27,
units = c("in", "cm", "mm"),
dpi = 600,
scale = 1,
device = NULL,
limitsize = TRUE,
...
)
plot |
a |
filename |
file name; its extension chooses the format. |
path |
directory to save in (default |
width, height |
size (default 11.69 x 8.27, A4 landscape, in |
units |
|
dpi |
resolution for raster formats (default 600). |
scale |
multiplicative scaling factor (default 1). |
device |
|
limitsize |
logical; refuse images larger than 50 x 50 inches (default |
... |
passed to |
The file name, invisibly.
Muhammad Yaseen (myaseen208@gmail.com)
Other dmai utilities:
dmai_notation(),
dmai_reference(),
dmai_theme()
library(ggplot2)
p <-
ggplot(data = data.frame(x = 1:10, y = (1:10)^2), mapping = aes(x = x, y = y)) +
geom_line() +
dmai_theme(
base_size = 11
, base_family = "serif"
, ticks_inward = TRUE
, legend_position = "bottom"
)
f <- tempfile(fileext = ".pdf")
dmai_save(
plot = p
, filename = f
, path = NULL
, width = 11.69
, height = 8.27
, units = c("in", "cm", "mm")[1]
, dpi = 600
, scale = 1
, device = NULL
, limitsize = TRUE
)
dmai_save(
plot = p
, filename = basename(f)
, path = tempdir()
, width = 11.69
, height = 8.27
, units = c("in", "cm", "mm")[1]
, dpi = 600
, scale = 1
, device = grDevices::cairo_pdf
, limitsize = TRUE
)
dmai_save(
plot = p
, filename = tempfile(fileext = ".png")
, path = NULL
, width = 6
, height = 4
, units = c("in", "cm", "mm")[1]
, dpi = 300
, scale = 1
, device = NULL
, limitsize = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.