How to subscript in figures
Mostra commenti meno recenti
Hello everyone,
I want to have subscript labels in axeses in matlab. Let say I have
J = [1 2 3; 4 5 6];
bar(J);
set(gca,'XTickLabel',{'I_0','I_1'});
I can't get I_0 in subscript. How can I do this. I m using Matlab 2009 on Ubuntu.
Risposta accettata
Più risposte (1)
For some unfathomable reason, TMW has not implemented the TeX or LaTeX interpreter for axis labels so you'll have no joy that route.
set(gca,'xticklabel',[]) % hide the existing labels
then use
xt=get(gca,'xtick').';
text(xt,-0.2*ones(size(xt)),num2str(xt-1,'I_%d'), ...
'horizontal','center')
(ADDENDUM--incorporate the horizontal alignment to center)
Salt to suit...
1 Commento
Aravin
il 14 Lug 2014
Categorie
Scopri di più su Axis Labels in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!