Learn R Programming

ggh4x (version 0.2.2)

strip_vanilla: Default strips

Description

Strips with the style of vanilla ggplot2.

Usage

strip_vanilla(clip = "inherit", size = "constant")

Value

A Strip ggproto object that can be used ggh4x facets.

Arguments

clip

A character(1) that controls whether text labels are clipped to the background boxes. Can be either "inherit" (default), "on" or "off".

size

A character(1) stating that the strip margins in different layers remain "constant" or are "variable".

See Also

Other strips: strip_nested(), strip_split(), strip_themed()

Examples

Run this code
# Some dummy data with a long string
df <- data.frame(
  short = "X",
  long  = "A very long string that takes up a lot of space",
  value = 1
)
# Simple plot
p <- ggplot(df, aes(value, value)) +
  geom_point() +
  theme(strip.text.y.right = element_text(angle = 0))

# Short titles take up as much space as long titles
p + facet_grid2(
  vars(short, long),
  strip = strip_vanilla(size = "constant")
)

# Short titles take up less space
p + facet_grid2(
  vars(short, long),
  strip = strip_vanilla(size = "variable")
)

Run the code above in your browser using DataLab