Skip to contents

This function constructs a spacer guide primitive.

Usage

primitive_spacer(
  space = NULL,
  title = waiver(),
  theme = NULL,
  position = waiver()
)

Arguments

space

A [<unit[1]>][grid::unit()]

title

A <character[1]> or <expression[1]> indicating the title of the guide. If NULL, the title is not shown. The default, waiver(), takes the name of the scale object or the name specified in labs() as the title.

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 <PrimitiveSpacer> primitive guide that can be used inside other guides.

Styling options

#' Below are the theme options that determine the styling of this guide. This guide does not have option dependent on its role as axis or legend.

  • gguidance.guide.spacing A <unit> setting the amount of spacing when the space argument is NULL.

Examples

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  guides(
    x = guide_axis_stack("axis", primitive_spacer(unit(1, "cm")), "axis")
  )