Aptech Store

Latex in plot title

I have the following code to make a plot:

struct plotControl myPlot;
plotSetTextInterpreter(&myPlot, "latex", "title");
font_name = "Times New Roman";

plotSetFonts(&myPlot, "all", "Times New Roman", 20);

myPlot = plotGetDefaults("xy");

plotSetTitle(&myPlot, "\\text{Estimated posterior mean of } \\tau_t \\text{(solid) and inflation (dashed)}", font_name, 20);
plotSetXLabel(&myPlot, "Years", font_name, 20);
plotSetYLabel(&myPlot, "%", font_name, 20);
plotSetYRange(&myPlot, -15, 20);

dstart = 1959;
freq = 4;
plotSetXTicLabel(&myPlot, "YYYY-QQ");
plotSetXTicInterval(&myPlot, 40, 196001);

LineStyle = { 1, 2 };
plotSetLineStyle(&myPlot, LineStyle);

plotTS(myPlot, dstart, freq, tau_hat~y);

However, the Latex characters in the title are not shown correctly. What should I do? I checked the blog posts, the manual, and tried different things, but I am unable to do it correctly.

2 Answers



0



accepted

Hello Sebzab!

The problem is that the call to plotGetDefaults() is after the call to plotSetTextInterpreter(). PlotGetDefaults() resets all plotcontrol settings.

admin

62


0



Thanks a lot for the quick answer, now it works! I didn't know that the order matters so much.

Your Answer

2 Answers

0
accepted

Hello Sebzab!

The problem is that the call to plotGetDefaults() is after the call to plotSetTextInterpreter(). PlotGetDefaults() resets all plotcontrol settings.

0

Thanks a lot for the quick answer, now it works! I didn't know that the order matters so much.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.