This function defines a custom ggplot2 layer that allows users to add labels to the colon parts based on the predefined blueprint. It takes in aesthetics for x, y, and part, and uses the StatColonLabels ggproto object to compute the necessary data for positioning and labeling the colon parts. The resulting layer can be used in conjunction with other ggplot2 layers to create detailed visualizations of the colon with informative labels.
geom_colon_label(
mapping = NULL,
data = NULL,
show.legend = NA,
variant = "standard",
...
)Set of aesthetic mappings created by aes(). If specified and
inherit.aes = TRUE (the default), it is combined with the default mapping
at the top level of the plot. You must supply mapping if there is no plot
mapping.
The data to be displayed in this layer. There are three options:
If NULL, the default, the data is inherited from the plot
data as specified in the call to ggplot().
A data.frame, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
fortify() for which variables will be created.
A function will be called with a single argument,
the plot data. The return value must be a data.frame, and
will be used as the layer data. A function can be created
from a formula (e.g. ~ head(.x, 10)).
logical. Should this layer be included in the legends?
NA, the default, includes if any aesthetics are mapped.
FALSE never includes, and TRUE always includes.
It can also be a named logical vector to finely select the aesthetics to
display. To include legend keys for all levels, even
when no data exists, use TRUE. If NA, all levels are shown in legend,
but unobserved levels are omitted.
A character string specifying the variant of the colon blueprint to use.
Additional parameters passed to the layer, such as fill, color, size, etc.
A ggplot2 layer that can be added to a plot to visualize labels on the colon parts.
The geom_colon_label function creates a layer that can be added to a ggplot2 plot. It requires the aesthetics x, y, and part to be specified, which correspond to the position and the specific part of the colon to be labeled.
The variants can be defined in the colon_variants list, which should contain different blueprints for the colon geometry.#'