Skip to contents

Like [ggplot2::element_text()], but the text is wrapped to the width available when the plot is drawn. [theme_eyesim()] uses it for the plot title, subtitle and caption.

Usage

element_text_wrap(...)

Arguments

...

Arguments passed to [ggplot2::element_text()].

Value

A theme element.

Examples

library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) + geom_point() +
  labs(caption = paste(rep("A long caption that wraps.", 8), collapse = " ")) +
  theme(plot.caption = element_text_wrap(hjust = 0))