How to fix overlapping tick labels?
Show older comments

I am trying to recreate the plot above. Here is what I have:

On the bottom left of my plot -273 and -200 are overlapping. Is it possible to fix it like in the original plot above by moving the just the -273 downwards?
Accepted Answer
More Answers (1)
Not so bad, just have to remember the trick, Walter... :)
Once you've got the ticks labeled as you have where you want them, then
xtk=xticklabels;
xtk(1)=strcat('\newline',xtk(1)); % prepend TeX command
xticklabels(xtk)
4 Comments
Oh, that's cute -- but it does result in the first tick being a different font face than the others !
plot(2:21, rand(1,20))
xtk=xticklabels;
xtk(1)=strcat('\newline\',xtk(1)); % prepend TeX command
xticklabels(xtk)
Walter Roberson
on 3 Sep 2022
It might be the \ before the number \newline\0 codes \0 which is probably a distinct character.
Categories
Find more on Axis Labels 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!

