Skip to content

Document option to provide labs() with functions #6700

@larmarange

Description

@larmarange

Following a request in labelled (cf. larmarange/labelled#186), and now that ggplot2 uses variable labels by default for axis titles, it would be convenient to be able to apply a labeller function on axis titles, such as label_parsed() or label_wrap_gen().

Following the approach used by ggtext presented in the FAQ (https://ggplot2.tidyverse.org/articles/faq-axes.html?q=parse#how-can-i-add-superscripts-and-subscripts-to-axis-labels), a general possibility could be to consider adding a labeller argument to element_text(), so it would be possible to do things such as:

p + 
  theme(
    axis.title.x = element_text(labeller = label_wrap_gen),
    axis.title.y = element_text(labeller = label_parsed)
  )

Would such a feature be worth considering?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions