primitive_bracket {legendry} | R Documentation |
Guide primitive: brackets
Description
This function constructs a brackets guide primitive.
Usage
primitive_bracket(
key = "range_auto",
bracket = "line",
angle = waiver(),
oob = "squish",
drop_zero = TRUE,
pad_discrete = 0.4,
levels_brackets = NULL,
levels_text = NULL,
theme = NULL,
position = waiver()
)
Arguments
key |
A range key specification. See more information in the linked topic. |
bracket |
A bracket by providing one of the following:
|
angle |
A specification for the text angle. Compared to setting the
|
oob |
A method for dealing with out-of-bounds (oob) ranges. Can be one
of |
drop_zero |
A |
pad_discrete |
A |
levels_brackets |
A list of |
levels_text |
A list of |
theme |
A |
position |
A |
Value
A <PrimitiveBracket>
primitive guide that can be used inside other
guides.
Styling options
Below are the theme options that determine the styling of this guide, which may differ depending on whether the guide is used in an axis or a legend context.
Common to both types is the following:
-
legendry.bracket
an<element_line>
for the line used to draw the brackets. -
legendry.backet.size
a<unit>
setting the space afforded to a bracket.
As an axis guide
-
axis.text.{x/y}.{position}
an<element_text>
for the text displayed over the brackets.
As a legend guide
-
legend.text
an<element_text>
for the text displayed over the brackets.
See Also
Other primitives:
primitive_box()
,
primitive_fence()
,
primitive_labels()
,
primitive_line()
,
primitive_segments()
,
primitive_spacer()
,
primitive_ticks()
,
primitive_title()
Examples
# A standard plot
p <- ggplot(mpg, aes(interaction(drv, year), displ)) +
geom_point()
key <- key_range_manual(c(2, 4), c(5, 6), c("A", "B"))
# Adding as secondary guides
p + guides(
x.sec = primitive_bracket(),
y.sec = primitive_bracket(key = key)
)