Skip to content

This guide can stack other position guides that represent position scales, like those created with scale_(x|y)_continuous() and scale_(x|y)_discrete().


  first = "axis",
  title = waiver(),
  theme = NULL,
  spacing = NULL,
  order = 0,
  position = waiver()



A position guide given as one of the following:

  • A string, for example "axis".

  • A call to a guide function, for example guide_axis().


Additional guides to stack given in the same manner as first.


A character string or expression indicating a title of guide. If NULL, the title is not shown. By default (waiver()), the name of the scale object or the name specified in labs() is used for the title.


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 unit() objects that determines how far separate guides are spaced apart.


A positive integer of length 1 that specifies the order of this guide among multiple guides. This controls in which order guides are merged if there are multiple guides for the same position. If 0 (default), the order is determined by a secret algorithm.


Where this guide should be drawn: one of top, bottom, left, or right.


The first guide will be placed closest to the panel and any subsequent guides provided through ... will follow in the given order.


#' # A standard plot
p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  theme(axis.line = element_line())

# A normal axis first, then a capped axis
p + guides(x = guide_axis_stack("axis", guide_axis(cap = "both")))