The cmapplot_globals
environment contains a list of predefined
variables for use by the cmapplot package and its users. It includes commonly
used colors, font and font size specifications, and a list of constants which
aid in drawing cmap-themed plots. It cannot be accessed directly, but the
helper functions described here provide the user access if needed.
get_cmapplot_globals()
get_cmapplot_global(...)
set_cmapplot_global(value, ..., quietly = FALSE)
get_cmapplot_globals()
: Get the entire environment as a list.
get_cmapplot_global()
: Get a specific global value
set_cmapplot_global()
: Set a specific global value
The primary portion of these global variables of
interest to the user is cmapplot_globals$consts
, a list of default
constants that set certain plot aesthetics. Units of all plot constants are
"bigpts": 1/72 of an inch. Most plot constants are invoked (and can be
overridden) in finalize_plot
: these are marked below with an
F. Some are used/can be overridden in theme_cmap
:
these are marked with T.
lwd_strongline
: This stronger-width line is drawn
vertically or horizontally with the hline, vline
args of
theme_cmap()
. (T)
lwd_gridline
: This
thinner-width line is drawn vertically or horizontally with the
gridlines, axislines
args of theme_cmap()
. (T)
lwd_plotline
: The width of any lines drawn by geoms in the plot (e.g.
geom_line
) but not explicitly sized by the geom's aesthetic.
Implemented by finalize_plot
or by apply_cmap_default_aes
but
not overridable in either context. (Modify by setting the size explicitly in
the geom, but see gg_lwd_convert
first.)
lwd_topline
:
The width of the line above the plot. (F)
length_ticks
: The length of the axis ticks (if shown). (T)
margin_topline_t
: The margin between the top edge of the image
and the top line. (F)
margin_title_t
: The margin
between the top line and the title. (F)
margin_title_b
: The margin between the title and the caption when
both are drawn in the sidebar. (F)
margin_caption_b
:
The margin between the bottom of the caption and the bottom edge of the
image. (F)
margin_legend_t
: The margin between the top
line and the plot box (i.e., the top of the legend). (F)
margin_legend_i
: The margin between legends (this only applies in
plots with two or more legends and does not affect legend spacing on plots
with single legends that have multiple rows). (T, F)
margin_legend_b
: The margin between the bottom of the legend and the
rest of the plot. (T, F)
margin_plot_b
: The margin
between the bottom of the plot and the bottom edge of the image (or top of
caption). (F)
margin_sidebar_l
: The margin between the
left edge of the image and the title and caption, when the sidebar exists.
Deducted from title_width
. (F)
margin_plot_l
:
The margin between the left edge of the plot and the sodebar. (F)
margin_plot_r
: The margin between the right edge of the plot
and the edge of the image. (F)
margin_panel_r
: Padding
between the plot and its right-hand drawing extent. Override this based on
space needed for x axis labels. (T)
leading_title
:
Text leading for Title text. (F)
leading_caption
: Text
leading for Caption text. (F)
# These are the same:
get_cmapplot_global("consts$lwd_gridline")
#> [1] 0.3
get_cmapplot_global("consts", "lwd_gridline")
#> [1] 0.3
# Globals can be modified if needed
set_cmapplot_global(5, "consts$lwd_gridline")
#> Item: consts$lwd_gridline
#> Old value: 0.3
#> New value: 5
get_cmapplot_global("consts$lwd_gridline")
#> [1] 5