primitive_ticks {legendry}R Documentation

Guide primitive: line

Description

This function constructs a ticks guide primitive.

Usage

primitive_ticks(key = NULL, bidi = FALSE, theme = NULL, position = waiver())

Arguments

key

A standard key specification. See more information in the linked topic.

bidi

A ⁠<logical[1]>⁠: whether ticks should be drawn bidirectionally (TRUE) or in a single direction (FALSE, default).

theme

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.

position

A ⁠<character[1]>⁠ giving the location of the guide. Can be one of "top", "bottom", "left" or "right".

Value

A PrimitiveTicks 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 in a legend context.

Common to both types is the following:

As an axis guide

As a legend guide

See Also

Other primitives: primitive_box(), primitive_bracket(), primitive_fence(), primitive_labels(), primitive_line(), primitive_segments(), primitive_spacer(), primitive_title()

Examples

# 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())

[Package legendry version 0.2.0 Index]