Generate a function to wrap and format facet labels with markdown
Source:R/theme_helpers.R
markdown_wrap_gen.RdThis function creates a labeller function for use with ggplot2 facets. It wraps long labels to a specified width and formats them as markdown, which allows them to be rendered correctly when using ggtext::element_markdown() in themes.
Examples
if (FALSE) { # \dontrun{
library(ggplot2)
library(hdatools)
ggplot(mtcars, aes(mpg, wt)) +
geom_point() +
facet_wrap(~vs, labeller = markdown_wrap_gen(width = 20)) +
theme_hda()
} # }