scheme
is an abstract base class that represents a configurable scheme with
a unique key
(the first class name). Developers should create subclasses of
scheme
to define specific schemes used in layouts or plotting contexts.
Scheme()
When creating a new subclass of Scheme
, you may optionally override the
following methods to customize its behavior:
scheme_init(scheme)
(optional): Initializes the scheme,
often by assigning default values or computing derived properties.
Default behavior: Returns the scheme unchanged.
scheme_update(e1, e2)
(optional): Defines how to
update a scheme by merging it with another of the same key (e.g., during
user overrides).
Default behavior: Replaces e1
entirely with e2
.
scheme_inherit(e1, e2)
(optional): Defines how a
scheme inherits from a parent scheme (e.g., a layout template), typically
merging instead of replacing.
Default behavior: Inheritance is ignored; e2
is returned unchanged.
plot_add_scheme(plot, scheme, ...)
: Applies the scheme
to a plot object (usually a ggplot
) by modifying the plot components,
theming, or annotations.
Developers should subclass Scheme
to implement specific behaviors (e.g.,
theme adjustments, alignment guides, layout spacings) and define how those
schemes are initialized, combined, and applied to plots.