How can I add subscripts, superscripts or Greek characters to my tick labels?

22 views (last 30 days)
Hello,
*How do you write Greek characters in XTickLabel?
*How do you subscript and superscript Greek characters in XTickLabel?

Answers (1)

Jan
Jan on 17 Jul 2013
Edited: Jan on 17 Jul 2013
You find a lot of solutions in the FileExchange, e.g.:
Simply search for "tick label" in the FileExchange for much more solutions.
Btw, it is recommended to search in the internet and especially the FEX before posting a question. You find many ready solutions there and save the time for typing the question and waiting for the answers.
  3 Comments
Susav Pradhan
Susav Pradhan on 7 Aug 2020
hi what is the answer...for ticklabels. Even for me
xticklabels({'\alpha','\beta'})
Does not work?
Walter Roberson
Walter Roberson on 7 Aug 2020
xticklabels({'\alpha','\beta'})
should work on any release new enough to have xticklabels(), which is R2016b or newer.
However, for it to work,
ax = gca;
ax.TickLabelInterpreter
must be 'tex' (which is the default.) In particular if TickLabelInterpreter is 'latex' then you would need
xticklabels({'$\alpha$','$\beta$'})
It is also possible to set the TickLabelInterpreter differently for each axes:
ax = gca;
ax.XRuler.TickLabelInterpreter = 'tex';

Sign in to comment.

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!