with certain plots setting yLim hides yticklabels

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 Comments

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?
oh, sorry, i must have had that defined in my top level work space and not noticed. i added it in the code above. i think it does matter. when i use a bare axes command it does not hide the yticklabels
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.
interesting discovery, Jing. this seems to be a bug to me? get(ax1,'ytick') returns empty vector, so they aren't just hiding, they've been removed. so yeah, set(ax1,'ytick',[.3e-8 .6e-8 12.6e-8]) puts them back in. but the yticklabels are all wrong of course. so i guess i can just make sure to set the yticks and labels last. but i don't always set them manually, so this might be a bear...
Jing
Jing on 2 Apr 2013
Edited: Jing on 2 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.

Sign in to comment.

Answers (0)

Categories

Asked:

on 28 Mar 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!