Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

theme_latex

Parse Labels w Latex Markup


Description

A series of convenience functions that either enable or disable the use of the latex2exp package for parsing the various text elements using the TeX method. In many cases, by turning the latex parsing on, this prevents confusing use of expressions to obtain greeks, superscripts, subscripts etc... Note that when latex parsing is enabled, this can override specific formatting directives from the element tree, see the third and fourth example below.

Usage

theme_latex(value = TRUE)

theme_showlatex()

theme_nolatex()

theme_hidelatex()

Arguments

value

logical as to whether to enable latex parsing or not

Author(s)

Nicholas Hamilton

See Also

Examples

#Demonstrate  without latex parsing
ggtern() + 
 theme_latex(FALSE) + 
 labs(title = '\\textit{Plot Title}')

#Same as before, but turn on the latex parsing
last_plot() + 
 theme_latex(TRUE)

#Demonstrate latex overriding the bold face
ggtern() + 
 labs(title = '\\textit{Plot Title}') + 
 theme_latex(TRUE) + 
 theme('plot.title' = element_text(face='bold'))

#Turn off latex parsing, bold title revealed
last_plot() + 
 theme_latex(FALSE)

ggtern

An Extension to 'ggplot2', for the Creation of Ternary Diagrams

v3.3.0
GPL-2 | file LICENSE
Authors
Nicholas Hamilton [aut, cre]
Initial release
2020-04-9

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.