View source: R/primitive-box.R
primitive_box | R Documentation |
This function constructs a boxes guide primitive.
primitive_box(
key = "range_auto",
angle = waiver(),
oob = "squish",
drop_zero = TRUE,
pad_discrete = 0.4,
min_size = NULL,
levels_box = NULL,
levels_text = NULL,
theme = NULL,
position = waiver()
)
key |
A range key specification. See more information in the linked topic. |
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 |
min_size |
A [ |
levels_box |
A list of |
levels_text |
A list of |
theme |
A |
position |
A |
A <PrimitiveBox>
primitive guide that can be used inside other
guides.
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 in a legend context.
Common to both types is the following:
legendry.box
an <element_rect>
for the boxes
to draw.
axis.text.{x/y}.{position}
an <element_text>
for the text inside the boxes.
legend.text
an <element_text>
for the text
inside the boxes.
Other primitives:
primitive_bracket()
,
primitive_fence()
,
primitive_labels()
,
primitive_line()
,
primitive_segments()
,
primitive_spacer()
,
primitive_ticks()
,
primitive_title()
# 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_box(),
y.sec = primitive_box(key = key)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.