View source: R/xtras_options.R
| set_xtras_options | R Documentation |
xpose.xtras session optionsConvenience wrapper around base options() for the xpose.xtras.*
family of options recognized by this package. Prefixes are added
automatically and names are validated against the list below, so e.g.
set_xtras_options(save_dir = "figures") is equivalent to (but safer
against typos than) options(xpose.xtras.save_dir = "figures").
Current values can be read back with regular getOption() (e.g.
getOption("xpose.xtras.save_dir")), or with get_xtras_option() for
default_labs/default_watermark, which also considers any
xpdb-level default.
set_xtras_options(...)
... |
< |
Recognized options (all unset, i.e. NULL, by default, except
auto_apply which defaults to TRUE):
auto_applyWhether print.xpose_plot() and
ggsave_xp() automatically apply configured default_labs/
default_watermark (labels always; a watermark only if
default_watermark is actually set at some tier – there's no
unprompted default watermark). Defaults to TRUE, but is a no-op
until default_labs/default_watermark are themselves configured, so
leaving it at its default has no visible effect on its own; set it to
FALSE to opt out of the auto-apply behavior everywhere at once (or
pass apply_labs/apply_watermark to a specific ggsave_xp() call
to opt out just there). print.xpose_plot() only ever sees the
session-wide option tier (not an xpdb-level one) for the same reason
noted under default_labs below.
default_labsNamed list of default title/subtitle/
caption/tag templates (may contain @keyword placeholders, see
xpose::parse_title()). Used by apply_default_labs() (and by
extension ggsave_xp()) as the lowest-precedence source for any
label a plot doesn't already have – xpdb-level defaults (see
set_default_labs()) and arguments passed directly to
apply_default_labs() both take precedence over this option.
default_watermarkNamed list of default add_watermark()
arguments (any of label/colour/alpha/size/angle/
fontface). Used by add_watermark() as the lowest-precedence
source – xpdb-level defaults (see set_default_watermark()) and
arguments passed directly to add_watermark() both take precedence
over this option.
default_plotsA list of plot specs (see plot.xpose_data())
used whenever plots isn't supplied directly to
plot.xpose_data(). Unlike default_labs/
default_watermark, this is resolved as a whole (not merged key by
key) – xpdb-level defaults (see set_default_plots()) take
precedence over this option, and a plots argument passed directly
takes precedence over both.
save_dir, save_width, save_heightDefaults for the
path/width/height arguments of ggsave_xp(), used whenever
those arguments aren't supplied explicitly.
save_funDefault save function for ggsave_xp() (itself
defaulting to ggplot2::ggsave() when this is unset), for swapping
in a drop-in alternative such as reportifyr::ggsave_with_metadata()
project-wide instead of passing save_fun to every ggsave_xp() call.
gg_theme, xp_themeDefault ggplot2 theme / xpose
xp_theme (see xpose::update_themes()) applied to an xpose_data
object the first time it's converted via as_xpdb_x(),
so a project-wide look can be set once per session instead of
calling xpose::update_themes() on every xpdb individually. Has
no effect on xpdbs that are already xp_xtras objects.
the previous values of the options that were set, invisibly
(see options())
get_xtras_option() to inspect which tier is currently
dominant for a two-tier option; apply_default_labs(),
add_watermark(), ggsave_xp(), and as_xpdb_x(), which consume
these options.
set_xtras_options(save_dir = "figures", default_watermark = list(label = "DRAFT"))
getOption("xpose.xtras.save_dir")
set_xtras_options(save_dir = NULL, default_watermark = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.