gf_* functionEvery function created by layer_factory() records the arguments
(geom, stat, position, aes_form, extras, pre, aesthetics,
inherit.aes, check.aes, required_packages, installed_packages)
it was built with. ggformula_spec() retrieves that record, which is
the recommended way for extension packages (or ggformula itself, e.g.
when building _interactive counterparts) to introspect a gf_*
function without depending on the internals of layer_factory().
ggformula_spec(gf_fun)A list with components geom, stat, position, aes_form,
extras, pre, aesthetics, inherit.aes, check.aes,
required_packages, and installed_packages, or NULL if gf_fun
was not created by layer_factory().
A function created by layer_factory() (e.g. gf_point).
The spec is stored in the function's enclosing environment rather than
as an attribute on the function, so that printing a gf_* function at
the console shows just the function. Use ggformula_spec() rather than
reaching for the binding directly; its name and location are an
implementation detail.
Note that pre is included precisely so that
interactive_layer_factory() (and similar tools) can replay it: some
gf_* functions (e.g. gf_text(), whose nudge_x/nudge_y handling
lives in pre, or gf_violin(), whose quantile_gp default is only
valid after pre computes it) depend on pre having already run
before any of their extras defaults are evaluated. Building a
variant without replaying pre can therefore produce broken or even
self-referential defaults.