View source: R/primitive-segments.R
primitive_segments | R Documentation |
This function constructs a guide primitive.
primitive_segments(
key = NULL,
space = rel(10),
vanish = FALSE,
theme = NULL,
position = waiver()
)
key |
A segment key specification. See more information
in the linked topic. Alternatively, an object of class
|
space |
Either a |
vanish |
Only relevant when the guide is used in the secondary theta
position: a |
theme |
A |
position |
A |
A <PrimitiveSegments>
primitive guide that can be used inside other
guides.
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.
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.
legend.ticks
an <element_line>
for display
of the segments.
legend.ticks.length
a <unit>
for the
base size of the segments in the orthogonal direction.
Other primitives:
primitive_box()
,
primitive_bracket()
,
primitive_fence()
,
primitive_labels()
,
primitive_line()
,
primitive_spacer()
,
primitive_ticks()
,
primitive_title()
# 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)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.