Prev: need help with matlab plot
Next: Speed up
From: Olive on 12 Jul 2010 21:44 I'm running 2009a on MacOS X 10.6.4. I'm getting (what looks to me like) a wacky response from get(gca, 'OuterPosition') in a plot generated with plotyy. I think that the problem can be seem here: %% clear all; close all; x1=0:0.1:10; y1=sin(x1); x2=0:0.1:10; y2=cos(x1); figure; hold on; plot(x1,y1); plot(x2, y2, '-g'); figchildren = get(gcf, 'Children'); for i=1:1:length(figchildren) axes(figchildren(i)); set(gca, 'Units', 'Pixels'); opos_pix = get(gca, 'OuterPosition') set(gca, 'Units', 'Normalized'); end figure; hold on; plotyy(x1, y1, x2, y2); figchildren = get(gcf, 'Children'); for i=length(figchildren):-1:1 axes(figchildren(i)); set(gca, 'Units', 'Pixels'); opos_pix2 = get(gca, 'OuterPosition') set(gca, 'Units', 'Normalized'); end %% The nearly first figure gives its OuterPosition in pixels as (1, 1, 560, 420). When the second plot is generated with plotyy, the OuterPosition is reported to be 1.0e+05 * (0.4126, 0.1978, 2.4317, 1.4384), which would be a 200,000 pixel wide box, which, well, obviously not. The results are similarly nutty in inches. (Note that the second plot contains two axes, but they have the same proportions in this example.) I'd like to get the correct OuterPosition values in absolute numbers (I'm basically running a script to apply overlays on the figure in LaTeX and I need the right proportions for the figure, but psfrag isn't meeting my exact needs). From my point of view, it would be good enough to have the correct proportions of the figure that I save using the print(fig, '-depsc', '-loose', filename) command, but I think that it would also be useful to understand exactly what OuterPosition thinks it contains.
|
Pages: 1 Prev: need help with matlab plot Next: Speed up |