Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex expression in R legend [duplicate]

Tags:

r

latex

What should I do to have R correctly show in a legend the equivalent to this latex expression?

\alpha \leq \beta

The following commands handle \alpha and \beta correctly, but not the \leq symbol:

expression(paste(alpha, " leq ", beta))

expression(paste(alpha, " <= ", beta))
like image 505
mossaab Avatar asked May 14 '13 21:05

mossaab


People also ask

How to add multiple legends to a plot in R?

You can add two or more legends to a plot, just running the legend function multiple times with different arguments. In the following example we are going to add two more Bessel functions and add a new legend for them. Note that you can also add more legends outside the plot, in case the legends doesn’t fit inside the layout.

What is Tex in R?

TeX converts a string comprising LaTeX commands (such as a math equation) to a plotmath expression. Plotmath expressions can be used throught R's graphic system to represent formatted text and equations. TeX ( input, bold = FALSE, italic = FALSE, user_defined = list (), output = c ("expression", "character", "ast") )

How to use latex tables in a plotmath expression?

A LaTeX command that matches one of the names is translated into the corresponding string and included in the final plotmath expression. The file symbols.R in the source code of this package contains one such table that can be used as a reference. The template string can include one of the following special template parameters:

How to change the legend size in R?

In order to change the legend size in R you can make use of the cex argument. Values bigger than 1 will lead to a bigger legend and smaller to smaller legends than the default.


1 Answers

Just use

expression(alpha <= beta)

For more info check out

?plotmath
like image 198
Dason Avatar answered Nov 08 '22 22:11

Dason