How do I fix this bug: xticklabel is not aligned with the xtick position.
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've been using Matlab for years and have only just come across this. Thankfully it's pretty simple to demonstrate. I get a weird bug when I run:
xAxis = -.25:.01:.25;
figure;plot(xAxis,rand(1,length(xAxis)));
set(gca,'xtick',-.1:.1:.1,'xticklabel',-100:100:100);
The central '0' label is offset from the position of the xtick for 0 (it isn't aligned).
I've run the code on 2014b, 2015b and 2016a and get the same result (all run on a Mac).
I imagine it's something to do with the way that Matlab aligns the string labels - it doesn't happen if the labels are all 0s for example. However it seems like quite a basic thing to get wrong...
Is there a fix for this bug or a quick workaround?
Thanks, Chris
1 Kommentar
Antworten (0)
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!