MATLAB bug for plotting? Overlap between the x-ticks and the number labels: when using inverted y-axis and logarithmic x-axis.
Mostra commenti meno recenti
Dear Matlab community,
I have been encountering the following issue for some time, and I haven't been able to find a way around it, so I believe it may be a bug.
PROBLEM: overlap between the number labels and the x-axis (and the x-ticks).
See files attached.
This only seem to occur when I use both
- Inverted y-axis
set(gca, 'YDir','reverse')
- Logaritmic x-scale
set(gca, 'XScale', 'log')
Any solution? Any suggestion?
Kind regards,
Daniel
7 Commenti
Adam Danz
il 16 Set 2020
- What matlab release are you using?
- Can you provide a minimal working example so we can reproduce this on our end?
Flipping the ydir and setting the x scale to log does not cause a problem for me (r2019b)
h = axes();
h.YDir = 'reverse';
h.XScale = 'log';
% Everything looks fine in r2019b
Star Strider
il 16 Set 2020
If I remember ccorrectly, that has since been fixed. Be certain you have all the latest Updates for your MATLAB version.
Daniel Fiuza Dosil
il 16 Set 2020
Daniel Fiuza Dosil
il 16 Set 2020
Adam Danz
il 16 Set 2020
Yes, you can install multiple versions of Matlab.
I find it surprising that programs didn't work in later releases of Matlab. With few exceptions, matlab releases are backward compatible so upgrading shouldn't be a problem.
If you don't want to use a new release, make sure you've installed all of the updates for your current release.
An alternative to upgrading to a newer release is to set the tick labels manually with text objects - this often causes a different set of problems with the axis resizes.
Daniel Fiuza Dosil
il 16 Set 2020
Adam Danz
il 16 Set 2020
Daniel Fiuza Dosil's answer moved here as a comment.
Please find below a minimal working example that reproduces the error in Matlab 2018b:
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
set(gca,'YDir','reverse')
set(gca,'XScale','log')
See below:

Thanks for your help!
Risposta accettata
Più risposte (1)
Steven Lord
il 16 Set 2020
1 voto
When I run the code in the Description section of bug report 1832634 I see the same type of problem as in your reproduction steps. That bug is listed as fixed in release R2019a.
1 Commento
Daniel Fiuza Dosil
il 16 Set 2020
Categorie
Scopri di più su Grid Lines, Tick Values, and 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!

