Math symbols in R charts: a cheat sheet

April 15, 2013
By

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you're creating a scientific graphic in the R language, there's a good chance you'll be wanting to include some mathematical symbols somewhere on the chart. You might want to use a symbol like μ as an axis label, annotate a curve with simple math like x2, or even put a complete equation like:

 Sumx

in the title. You can do this easily in R using the plotmath syntax. Using escape sequences reminiscent of LaTeX, you can include beautifully-formatted mathematical symbols and equations in charts wherever you can place text. For example, the summation above can be added to a plot with an R statement like text(2,5,expression(sum(x[i], i=1, n)). This cheat sheet on mathematical annotation in R provides a guide to commonly-used symbols and equations, including:

Plotmath
The cheat sheet comes courtesy of Vistat, a site that provides working recipes for statistical graphics. R programmers should also check out this cheat sheet for plotting symbols and colors for R graphics.

Vistat: Mathematical Notation in R (via Yihui Xie)

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)