Skip to contents

Secondary axis for text annotations

Usage

sec_axis_text(
  breaks = function(x) mean(x),
  labels = ggplot2::waiver(),
  name = NULL,
  guide = guide_sec_axis_text(),
  ...
)

Arguments

breaks

A function or numeric vector giving the break position(s) used to anchor the text. Defaults to \(x) mean(x), which places a single label at the midpoint of the scale limits for continuous scales.

labels

One of:

  • A character vector of labels, the same length as breaks

  • A function that takes break positions as input and returns labels If left as ggplot2::waiver(), labels are derived from the break positions and may be numeric.

name

The name of the secondary axis. Use ggplot2::waiver() to derive the name from the primary axis, or NULL (default) for no name.

guide

A guide object used to render the axis. Defaults to guide_sec_axis_text(), which makes transparent ticks and lines.

...

Additional arguments passed to ggplot2::dup_axis().

Value

A AxisSecondary object for use in the sec.axis argument of scale_x_continuous() or scale_y_continuous().