primitive_fence {legendry} | R Documentation |
Guide primitive: fence
Description
This function constructs a fence guide primitive. The customisation options are easier to understand if we view fence 'post' as the vertical pieces of a real world fence, and the 'rail' as the horizontal pieces.
Usage
primitive_fence(
key = "range_auto",
rail = "none",
angle = waiver(),
oob = "squish",
drop_zero = TRUE,
pad_discrete = 0.5,
levels_text = NULL,
levels_post = NULL,
levels_rail = NULL,
theme = NULL,
position = waiver()
)
Arguments
key |
A range key specification. See more information in the linked topic. |
rail |
A |
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_text |
A list of |
levels_post , levels_rail |
A list of |
theme |
A |
position |
A |
Value
A <PrimitiveFence>
primitive guie 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 legend context.
Common to both types is the following:
-
legendry.fence.post
an<element_line>
for the line used to draw the pieces orthogonal to the direction of the scale. -
legendry.fence.rail
an<element_line>
for the line used to draw the pieces parallel to the direction of the scale.
As an axis guide
-
axis.text.{x/y}.{position}
an<element_text>
for the text displayed.
As a legend guide
-
legend.text
an<element_text>
for the text displayed.
See Also
Other primitives:
primitive_box()
,
primitive_bracket()
,
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_fence(rail = "inner"),
y.sec = primitive_fence(key = key, rail = "outer")
)