This function constructs a ticks guide primitive.
primitive_ticks(key = NULL, bidi = FALSE, theme = NULL, position = waiver())
A PrimitiveTicks
primitive guide that can be used inside other
guides.
A standard key specification. See more information in the linked topic.
A <logical[1]>
: whether ticks should be drawn bidirectionally
(TRUE
) or in a single direction (FALSE
, default).
A <theme>
object to style the guide individually or
differently from the plot's theme settings. The theme
argument in the
guide overrides and is combined with the plot's theme.
A <character[1]>
giving the location of the guide. Can be one of "top"
,
"bottom"
, "left"
or "right"
.
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:
axis.ticks.{x/y}.{position}
an <element_line>
for major tick lines.
axis.minor.ticks.{x/y}.{position}
an
<element_line>
for minor tick lines.
legendry.axis.mini.ticks
an <element_line>
internally inheriting from the minor ticks for the smallest ticks in e.g.
log axes.
axis.ticks.length.{x/y}.{position}
a <unit>
for the major
ticks length.
axis.minor.ticks.length.{x/y}.{position}
a <unit>
for the
minor ticks length.
legendry.axis.mini.ticks.length
a <unit>
internally
inheriting from the minor tick length for the smallest ticks in e.g.
log axes.
legend.ticks
an <element_line>
for major tick
lines.
legendry.legend.minor.ticks
an <element_line>
for minor tick lines.
legendry.legend.mini.ticks
an <element_line>
for the smallest ticks in e.g. log axes.
legend.ticks.length
a <unit>
for the major ticks length.
legendry.legend.minor.ticks.length
a <unit>
for the
minor ticks length.
legendry.legend.mini.ticks.length
a <unit>
for the
smallest ticks in e.g. log axes.
Other primitives:
primitive_box()
,
primitive_bracket()
,
primitive_fence()
,
primitive_labels()
,
primitive_line()
,
primitive_segments()
,
primitive_spacer()
,
primitive_title()
# A standard plot
p <- ggplot(mpg, aes(displ, hwy)) +
geom_point()
# Adding as secondary guides
p + guides(x.sec = primitive_ticks(), y.sec = primitive_ticks())
Run the code above in your browser using DataLab