MATLAB Answers

How to add mathematical symbols to text within the legend

301 views (last 30 days)
Darryl
Darryl on 22 Nov 2013
Commented: Darryl on 22 Nov 2013
I'm finding it difficult to add the maths symbol /phi to my actual legend. I am able to add mathematical symbols to the title, but not the legend. I normally plot my data vectors, then edit the name, etc. of them within the plot tools rather than the command line.
I want to be able to state the number 45 followed by /phi (45/phi)

  0 Comments

Sign in to comment.

Accepted Answer

Kelly Kearney
Kelly Kearney on 22 Nov 2013
The legend command should accept TeX symbols by default, just as titles, x/ylabels, etc:
plot(rand(10,1));
hl = legend('45\phi');
If not, try
set(hl, 'interpreter', 'tex')

Sign in to answer this question.