GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Javascript (v4.1.1)
  • Python (v7.1.0)
  • R
  • Julia
  • Javascript (v4.1.1)
  • ggplot2
  • MATLAB
  • F#
  • Download Studio
  • Studio and Cloud Pricing
  • Dash Enterprise Pricing
  • Getting Started
  • Is Plotly Free?
  • Figure Reference

This view

  • Original page
  • New address

GeezerVison is showing plotly.com — Latex in JavaScript

Quick Reference
On This Page
View open positions at Plotly.

Plotly.js renders LaTeX in titles, axis labels, annotations, and legend entries when MathJax is loaded on the page. Wrap the expression in $ delimiters, as in the example below.

Plotly.js v4 supports MathJax v3 and v4, and uses the tex-svg component. Load one of the following before plotly.js:

<!-- MathJax v3 -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js"></script>
<!-- or MathJax v4 -->
<script src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-svg.js"></script>

MathJax v2 is no longer supported. If your page loads MathJax.js?config=TeX-MML-AM_CHTML, replace it with one of the tags above — the ?config= query string is not used from MathJax v3 onward, since the component is selected by the file you load.

LaTeX Typesetting

// remember to load MathJax v3 or v4 (tex-svg.js) - see https://plotly.com/javascript/LaTeX/
var trace1 = {
  x: [1, 2, 3, 4],
  y: [1, 4, 9, 16],
  name: '$\\alpha_{1c} = 352 \\pm 11 \\text{ km s}^{-1}$',
  type: 'scatter'
};
var trace2 = {
  x: [1, 2, 3, 4],
  y: [0.5, 2, 4.5, 8],
  name: '$\\beta_{1c} = 25 \\pm 11 \\text{ km s}^{-1}$',
  type: 'scatter'
};
var data = [trace1, trace2];
var layout = {
  xaxis: {
    title: {
      text: '$\\sqrt{(n_\\text{c}(t|{T_\\text{early}}))}$'
    }
  },
  yaxis: {
    title: {
      text: '$d, r \\text{ (solar radius)}$'
    }
  }
};
Plotly.newPlot('myDiv', data, layout);
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.