# LaTeX Basics with Plotly

A Step by Step Guide to LaTeX Basics with Plotly

### LaTeX Basics

LaTeX is a typesetting system used by mathematicians, physicists, computer scientists, economists, and others. If you want to include mathematical symbols, superscripts, subscripts, or equations in your Plotly graph, LaTeX is a great choice. In this tutorial, we’ll show you the basics of integrating these features.

For this tutorial, we've used a graph that can be found here. This is a version of the Bessel function graph you see above, with the axes labels deleted. By the end, we'll have reproduced the same annotations.

Click on 'Fork & Edit' to open this graph in the new online workspace.

To tell Plotly that you want to use LaTeX, you’ll need to put a dollar sign ($) on both sides of the text you enter. For example, to get the LaTeX logo, you have to type 'LaTeX' as '$LaTeX$'. We’ll show you many more examples below.

### Using LaTeX

We’ll start by labeling our y-axis with the Bessel Function equation.

Move your mouse to where the y-axis label should go, and the 'Click to enter y axis' title will appear. Type or copy-and-paste: '$J_\nu(X)$' and press the enter key. You've just labeled your y-axis using LaTeX.

The dollar sign tells Plotly to use LaTeX, and the underscore symbol (_) tells LaTeX to make the '*ν*' part of the code appear as a subscript.

Now we’re ready to label the x-axis using some of the code featured in the table at the end of the page.

Hover over the empty x-axis field, and click to enter your label.

The text we need is '$x^2 \frac{d^2 y}{dx^2} + x \frac{dy}{dx} + (x^2 - \nu^2)y = 0$' (feel free to copy and paste). Press the enter key to see the x-axis label with LaTeX.

If you click on the legend labels, you'll see that each one has LaTeX integrated.

### LaTeX in Text Editor

Another way to add labels to your axes is by clicking STYLE on the left-hand side of the workspace, then 'Axes'. The 'Titles' tab in this section displays two options: the rich text editor and LaTeX editor.

Type your command(s) in the LaTex editor to label your axes.

The same can be done for your chart title. Go to the 'Layout' section under STYLE, click on 'Title and Fonts' and enter your command(s) in the LaTeX editor, as shown below.

You can also use LaTeX for your notes. To locate the LaTex editor for your annotations, go to STYLE, then 'Notes'. Click on the blue '+ Annotation' button at the top of the panel and choose any from the dropdown menu. To learn more about annotations, visit this page.

### LaTeX Commands

LaTeX commands allow you to use Greek letters, superscripts, subscripts, and fractions.

The table below lists a few popular commands.

If you’re looking for the code for a symbol that isn’t included below, we like Detexify. You can draw the symbol you're looking for, and a list of code possibilities is generated.