with certain plots setting yLim hides yticklabels
Ältere Kommentare anzeigen
i have custom code to make uniform plots with many plots per figure. they can have y1 and/or y2 axes. recently i came across a problem where the yticklabels were being hidden (or erased?) when that plot/axes xlabel was too tall (eg, had exponentials, or two lines). i tried to reproduce this to no avail. but i did find something similar:
thisPlotPos = [0 0.5355 0.5 0.4214];
ax1=axes('OuterPosition',thisPlotPos , ...
'FontSize' ,8 , ...
'LineWidth' ,1 , ...
'Color' ,'none' , ...
'TickDir' ,'out' , ...
'TickLength' ,[.01 .01] , ...
'XMinorTick' ,'on' , ...
'YMinorTick' ,'on' , ...
'XColor' ,[.3 .3 .3] , ...
'YColor' ,[.3 .3 .3] );
y = 1.0e-11 .* [0.0580 0.0126 0.0003 0.0580 0.2394 0.0006 0.0030 0.9724 0.2394 ...
0.0126 0.0030 0.7852];
x = [450 105 4 450 1800 8 28 7200 1800 105 28 5820];
plot(x,y);
set(ax1,'YScale','log');
%%%%below hides the yticklabels??
% if i alter the data range a bit, other operations hide the yticklabels
% it's really strange
set(ax1,'YLim',[0 0.1491e-10]);
the above method only hides yticklabels with that data. with slightly different data something else can hide the ticklabels, like xlabel, or setting YGrid 'on'.
i'm in 8.0.0.783 (2012b)
ideas?
5 Kommentare
Jing
am 29 Mär. 2013
I don't have the 'thisPlotPos' in your code, so I don't include this property. The other codes is exactly the same as yours, but the yticklabels didn't hide from me, it's 10^-11, 10^-12, 10^-13, 10^-14.
Does the OuterPosition matter?
Eric
am 30 Mär. 2013
Jing
am 1 Apr. 2013
It seems related to the Position, when I set 'Position' property to [.1 .1 1 0.5] or enlarge the figure window a little bit, you can see the yticklabels. I think this is due to the height of the tick...If you set the ytick manually, you can see them too. Not sure if this is a bug.
Eric
am 1 Apr. 2013
Yes, this may be a bug. Because the tick should not be changed or removed when zooming the figure window, that's a basic requirement.I set the ytick to [1e-13 1e-12], which looks right to me. BTW, remember to set set(ax1,'ytickmode','manual') before setting ytick.
Anyway, it seems to me when the scale is log, we can only have ticks of 1e-xx. That may be the cause when you set the limit to 0.1491e-10. You can try set the limit to 0.1e10, which works fine.
Antworten (0)
Kategorien
Mehr zu Axis Labels finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!