| ggsave_xp | R Documentation |
xpose.xtras default output resolutionA ggplot2::ggsave()-compatible wrapper (defaulting to
ggplot2::ggsave() itself, but swappable via save_fun – e.g. for
reportifyr::ggsave_with_metadata() or any other function sharing
ggsave()'s plot/filename/path/width/height signature).
Before saving: resolved labels are applied via apply_default_labs()
and a configured watermark (if any) via add_watermark() – see
apply_labs/apply_watermark, both of which default to the
xpose.xtras.auto_apply option (TRUE unless changed), the same
switch print.xpose_plot() uses, so a plot looks the
same whether it's viewed interactively or saved with ggsave_xp().
filename/path have any @keyword placeholders expanded via
xpose::parse_title(), the same way xpose::xpose_save() does
(independent of which save_fun is used, since most save functions
don't do this themselves); and path/width/height/save_fun fall
back to the xpose.xtras.save_dir, xpose.xtras.save_width,
xpose.xtras.save_height, and xpose.xtras.save_fun R options when not
supplied explicitly, so a project can set output defaults once (see
set_xtras_options()).
ggsave_xp(
plot = ggplot2::last_plot(),
filename,
path = getOption("xpose.xtras.save_dir"),
width = getOption("xpose.xtras.save_width", 7),
height = getOption("xpose.xtras.save_height", 6),
xpdb = NULL,
apply_labs = getOption("xpose.xtras.auto_apply", TRUE),
apply_watermark = getOption("xpose.xtras.auto_apply", TRUE),
save_fun = getOption("xpose.xtras.save_fun", ggplot2::ggsave),
...
)
plot |
< |
filename |
< |
path |
< |
width, height |
< |
xpdb |
< |
apply_labs |
< |
apply_watermark |
< |
save_fun |
< |
... |
Passed on to |
the result of save_fun (for the default ggplot2::ggsave(),
the saved file path, invisibly)
set_xtras_options() for the full list of xpose.xtras.*
session options.
## Not run:
options(xpose.xtras.save_dir = "figures", xpose.xtras.save_width = 8)
p <- xpose::dv_vs_ipred(xpose::xpdb_ex_pk)
ggsave_xp(p, filename = "dv_vs_ipred.png")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.