LaTeX in JavaScript
How to add LaTeX to javascript D3.js-based graphs.
New to Plotly?
Plotly is a free and open-source graphing library for JavaScript. We recommend you read our Getting Started guide for the latest installation or upgrade instructions, then move on to our Plotly Fundamentals tutorials or dive straight in to some Basic Charts tutorials.
// remember to load MathJax.js?config=TeX-MML-AM_CHTML
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);