Latex typesetting for axis title not working with Matlab

I know this feature used to work. However, now when I include latex in the title I get a plot with no titles.

Any ideas?

I am using:
Matlab R2017a (9.2.0.538062)
64-bit (maci64)

and

Matlab R2016b (9.1.0.441655)
64-bit(maci64)

I edited post to show a simple example.

trace1 = struct(...
    'x', [1, 2, 3, 4], ...
    'y', [1, 4, 9, 16], ...
    'name', 'x2', ...
    'type', 'scatter');
trace2 = struct(...
    'x', [1, 2, 3, 4], ...
    'y', [0.5, 2, 4.5, 8], ...
    'name', 'x1', ...
    'type', 'scatter');
data = {trace1, trace2};
layout = struct(...
    'title', 'Latex Example',...
    'xaxis', struct('title', '$\sqrt{(n_\text{c}(t|{T_\text{early}}))}$'), ...
    'yaxis', struct('title', 'No latex'));

p = plotlyfig;
p.data=data;
p.layout=layout;
saveplotlyfig(p,'latex_example.pdf');

1 Like

I am having the same problem, using Plotly 1.0 and 2.0.

What version of Matlab are you using?

Less than two weeks ago I was able to generate graphs with LaTeX in the axis title. I don’t know what changed.

$\text{Absorbed Dose}\;\left(\mu\,Gy\right)$

to yield the attached figure.

I’m using python to generate the graphs, but I think it’s a problem with plotly in general. It also worked for me until a couple of weeks ago. The only solution I currently have is to take a screenshot of the graph rather than exporting it.

I have a similar problem with plotly for python. As soon as I start using LaTeX in the title of y-axis the title disappears completely. At the same time x-axis title works just fine. I use Plotly version 4.14.3 (installed from conda)