
Using special characters and formatting
Source:vignettes/special_characters_formatting.Rmd
special_characters_formatting.RmdSpecial characters
To use special characters, put the unicode codepoint in your text
(e.g. \u2265 for a greater-than-or-equal sign, and
\u00B2 for a superscript 2). In forest_plot()
row labels you need to use HTML entities (e.g. ²
for a superscript 2). If these does not work, you may need to add the
required ggplot2::geom_text() layer to your plot
manually.
Expressions
The ggplot2::geom_text() function has an argument
parse which tells ggplot2 to parse text into expressions
and display as described in plotmath. In
forest_plot(), the col.right.parse argument in
forest_plot() can be used to choose which of the
col.right columns should be parsed as expressions. For
other plot text (such as col.left) use the
addarg argument to parse the text as expressions.
ggtext
The ggtext package adds
support for some Markdown and HTML when plotting text. Row labels in
forest_plot() already use
ggtext::element_markdown(). For other parts of plots, you
may want add ggtext::geom_richtext() layers to include
formatted text.