Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab horizontal axis labeling with TEX interpreter

I have followed this thread to come up with X-axis labels for my graph. However, I want Matlab to treat the labels as tex code. In other words, when I have K_1, I want Matlab to display it as K subscript 1. How can I do that?

like image 465
emper Avatar asked Jan 24 '26 21:01

emper


1 Answers

This is a bit ugly solution, but still...

You can remove the ticks and add text elements manually:

x = 1:5;
y = x.*x;
plot(x, y, 'b')
set(gca, 'XTick',[]);
text(1,-0.8,'A_1');
text(2,-0.8,'B_1');
text(3,-0.8,'C_1');
text(4,-0.8,'D_1');
text(5,-0.8,'E_1');

enter image description here

like image 195
Andrey Rubshtein Avatar answered Jan 27 '26 20:01

Andrey Rubshtein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!