|
|
Re: axis size changes when removing tick labels
Posted:
Jan 22, 2013 4:23 PM
|
|
"rachael " <rmueller@coas.oregonstate.edu> wrote in message <kdk4og$qsu$1@newscl01ah.mathworks.com>... > dpb <none@non.net> wrote in message <kcn2rc$e1m$2@speranza.aioe.org>... > > On 1/10/2013 10:48 AM, rachael wrote: > > > I'm going to file a bug report. > > > > Please don't toppost--hard conversation follow makes... > > > > Have you checked renderer settings, etc., that it may be a fignewton of > > the particular graphics drivers, hardward display card, etc., etc., ...? > > > > -- > > Okay, Yoda, I won't "toppost" this time. :-) > > I suppose I hadn't considered fignewtons in my graphics drivers or hardware. You may be onto something to detect a delectable, yet erroneous, "treat" in my system but the "renderer" alone doesn't appear to do the trick. > > Here is the work around that was offered by a Mathworks tech. with whom I troubleshot the issue: > > fig = figure; > set(fig, 'color','w'); > hndl = axes('Position',[0 0 1 1], 'Visible','off','color','w'); > ax = [0,800,1800,3000]; > position = [0.1 0.1 0.3 0.7]; % of axes1. > xLim = [0,800]; > yLim = [1800,3000]; > > axes1 = axes(... > 'OuterPosition', [0.1 0.1 0.3 0.7], ... > 'Parent', fig, ... > 'fontsize', 12); > > axes2 = axes(... > 'OuterPosition', [0.5, 0.1 0.3 0.7],... > 'Parent', fig, ... > 'fontsize', 12, ... > 'yticklabel', []); > > hold(axes1,'all'); > hold(axes2,'all'); > > % plot bathymetry > pcolor(axes1, ws.y, ws.x , ws.h); > pcolor(axes2, ws.y,ws.x , ws.h); > shading(axes1, 'flat'); > shading(axes2, 'flat'); > > axis([axes1, axes2], 'equal'); > > %% NOTE: setting the 'xlim' and 'ylim' here is what really seems to do the fix. The %% code I had used before was along the lines of "axis([axes1, axes2], ax)", but this %% code (now) produces uneven yaxes. Specifyin the xlim and ylim independently %% seems to be the ticket. > set(axes1,... > 'layer' ,'top',...% Draw axes lines above data > 'position',position,... > 'xLim' ,xLim,... > 'yLim' ,yLim); > > set(axes2,... > 'layer' ,'top',...% Draw axes lines above data > 'position',position + [0.4 0 0 0],... > 'xLim' ,xLim,... > 'yLim' ,yLim);
When you use the axis function, it usually sets your axes to an annoying "stretch to fill" mode, which is kind of (but not really) explained here: http://www.mathworks.com/help/matlab/visualize/understanding-axes-aspect-ratio.html
It's related to some rather obscure axes properties that i can never figure out. As suggested by the workaround, when you need your axes to do exactly what you want them to do, it's best to avoid axis() and set the limits directly with the set function.
|
|