This function constructs a guide primitive.
Arguments
- key
A segment key specification. See more information in the linked topic. Alternatively, an object of class
<hclust>that automatically invokeskey_dendro().- space
Either a
<unit>or<rel>object of length 1 determining the space allocated in the orthogonal direction. When thespaceargument is of class<rel>(default) the base size is taken from the tick length theme setting.- vanish
Only relevant when the guide is used in the secondary theta position: a
<logical[1]>on whether the continue to draw the segments until they meed in the center (TRUE) or strictly observe thespacesetting (FALSE).- theme
A
<theme>object to style the guide individually or differently from the plot's theme settings. Thethemeargument in the guide overrides and is combined with the plot's theme.- position
A
<character[1]>giving the location of the guide. Can be one of"top","bottom","left"or"right".
Styling options
Below are the theme options that determine the style of this guide, which may differ depending on whether the guide is used in an axis or in a legend context.
As an axis guide
axis.ticks.{x/y}.{position}an<element_line>for display of the segments.axis.ticks.length.{x/y}.{position}a<unit>for the base size of the segments in the orthogonal direction.
As a legend guide
legend.ticksan<element_line>for display of the segments.legend.ticks.lengtha<unit>for the base size of the segments in the orthogonal direction.
See also
Other primitives:
primitive_box(),
primitive_bracket(),
primitive_fence(),
primitive_labels(),
primitive_line(),
primitive_spacer(),
primitive_ticks(),
primitive_title()
Examples
# Building a key
key <- key_segment_manual(
value = c(1.6, 1.6, 3.4, 5.2),
value_end = c(7.0, 7.0, 3.4, 5.2),
oppo = c(1.0, 2.0, 0.0, 0.0),
oppo_end = c(1.0, 2.0, 3.0, 3.0)
)
# Using the primitive in a plot
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
scale_x_continuous(
guide = primitive_segments(key = key)
)
