Why do tick directions change when log scaling x-axis?
Mostrar comentarios más antiguos
I just updated to Matlab 2018b (9.5.0.94444444) and I have come across a weird glitch when changing a plot axis scaling to logarithmic, from linear. I haven't come across this problem before in previous versions, but I haven't found a solution to this maddeningly simple problem. Here's an example that highlights the issue I see:
figure(1)
ha1 = subplot(2,1,1);
plot(1:10,linspace(1,100,10))
ha1.XDir = 'reverse';
title(ha1,'Linear axis scaling: no problem')
ha2 = subplot(2,1,2);
plot(1:10,linspace(1,100,10))
ha2.XDir = 'reverse';
ha2.XScale = 'log';
title(ha2,'X-axis log-scaled: tick direction problem')
Now with ha2, the x- and y-axes behave contrastly when setting:
ha2.TickDir = 'in';% or 'out'

Changing TickDirMode to "manual" or "auto" has no affect.
Any help is appreciated. Thanks.
1 comentario
Dave Ortiz-Suslow
el 18 de Dic. de 2018
Respuesta aceptada
Más respuestas (2)
Cris LaPierre
el 18 de Dic. de 2018
0 votos
I wonder if it is related to this question. There, it was a bug potentially related to having an exponent in the axis.
4 comentarios
Walter Roberson
el 18 de Dic. de 2018
If it was... I wonder if setting the Exponent or ExponentMode properties could help? (I note from what you linked to that HG2 is involved.)
Dave Ortiz-Suslow
el 18 de Dic. de 2018
Cris LaPierre
el 18 de Dic. de 2018
Editada: Cris LaPierre
el 18 de Dic. de 2018
But the root cause is the same - reversing the direction of one of the axes. Don't do that, and your labels will appear normal.
Agreed - it shouldn't be there. But that's the nature of bugs. They are not there intentionally.
FWIW, I checked this in the 2019a prerelease software (might be able to see it here if you have access). This bug has been fixed.
Dave Ortiz-Suslow
el 18 de Dic. de 2018
Editada: Dave Ortiz-Suslow
el 18 de Dic. de 2018
Dave Ortiz-Suslow
el 18 de Dic. de 2018
Editada: Dave Ortiz-Suslow
el 18 de Dic. de 2018
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

