Show Sidebar Hide Sidebar

LaTeX Typesetting in R Graphs in R

How to add LaTeX to R graphs.

New to Plotly?

Plotly's R library is free and open source!
Get started by downloading the client and reading the primer.
You can set up Plotly to work in online or offline mode.
We also have a quick-reference cheatsheet (new!) to help you get started!

Version Check

Version 4 of Plotly's R package is now available!
Check out this post for more information on breaking changes and new features available in this version.

## [1] ''

LaTeX Typesetting

p <- plot_ly(
    x = c(1, 2, 3, 4), 
    y = c(1, 4, 9, 16),
    name = TeX("\\alpha_{1c} = 352 \\pm 11 \\text{ km s}^{-1}")) %>% 
    x = c(1, 2, 3, 4), 
    y = c(0.5, 2, 4.5, 8),
    name = TeX("\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}")) %>%
    xaxis = list(
      title = TeX("\\sqrt{(n_\\text{c}(t|{T_\\text{early}}))}")),
    yaxis = list(
      title = TeX("d, r \\text{ (solar radius)}"))) %>%
  config(mathjax = 'cdn')

# Create a shareable link to your chart
# Set up API credentials:
chart_link = api_create(p, filename="latex-1")


For more information about LaTeX, click here.

Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to a Developer Support Plan.