Open karlmsmith opened 6 years ago
Comment by @AnsleyManke on 15 May 2008 17:48 UTC More comments:
I guess I don't understand why the code is adjusting to allow for the white space margins in a viewport defined with /AXES, when there will not (necessarily) be white space between the edges of the viewport and the plot axes. There are extensive comments in fer/plt/vp_axlim2lim.F, indicating a need to adjust if, say, the origin is specified at (0,0). If a viewport is specified covering the entire window:
define view/axes/xlim=0:1/ylim=0:1 allfull
then the resulting viewport still covers the entire window, the result of the adjustment is "no change".
If the viewports are small and away from the edges, then they are also unchanged. It's when the edges of the viewports are pretty close to the edge of the plot page that we see it adjusting.
What causes the difference between left and right viewports is use of the default margins in /fer/plt/vp_axlim2lim.F, xorg=1.2,xright=1, yorg=1.4, ytop=1.4, which are obtained from a common block on the Ferret side, not from any settings the user might have made changing the origin.
VP_AXLIM2LIM makes a calculation whether a normalized limit is exceeded, I think this is whether the margin will extend off the plot page. Because xorg is not the same as xright, this test is different for a left viewport which might go outside the margin to the left and the right viewport which might go out to the right.
XEQ_DEFINE calls VP_AXLIM2LIM iteratively. Here is a comment from XEQ_DEFINE
Maybe the answer is to use the same nominal margin size for left and right in the adjusting routine VP_AXLIM2LIM.
Reported by @AnsleyManke on 14 May 2008 22:46 UTC Reported by Billy Kessler. Note the difference in ppl$xlen between left- and right-side viewports; and likewise ppl$ylen.
yes? def vi/axes/xli=.0,.5/yli=.5,1 ul yes? def vi/axes/xli=.0,.5/yli=.0,.5 ll yes? def vi/axes/xli=.5,1/yli=.5,1 ur yes? def vi/axes/xli=.5,1/yli=.0,.5 lr
yes? ! make a square window yes? set win/asp=1.0
yes? set vi ul yes? PLOT/NOY/VS/LINE/I=1:314 icos(i/20),isin(i/20) yes? say ($ppl$xlen), ($ppl$ylen),
($ppl$xlen)/($ppl$ylen)
6.084, 6.084, 1yes? set vi ur yes? PLOT/NOY/VS/LINE/I=1:314 icos(i/20),isin(i/20) yes? say ($ppl$xlen), ($ppl$ylen),
($ppl$xlen)/($ppl$ylen)
6.039, 6.039, 1The axes in the left-hand viewports are about 2% longer than the right-hand ones.
This happens because the code is trying to still allow for white space around the plot. This is in calls to vp_axlim2lim from xeq_define. In fer/plt/vp_axlim2lim.F, there are fixed parameters for the default margin sizes and the axes are adjusted to try to allow for those margins. When viewports are defined with /AXES, it seems to me we should get rid of this logic and just let the user worry about whether things are running off the page. If vp_axlim2lim is just not called from xeq_define.F, the size of the viewport depends only on the XLIMITS and YLIMITS and on nothing else, and the axis lengths are consistent.
PLOT commands still by default do an adjustment on the Y origin to allow room for a plot key. In hindsight, it might have been better to have the default be no adjustment and a /YADJUST qualifier to have Ferret make an adjustment, but there we are.
Migrated-From: http://dunkel.pmel.noaa.gov/trac/ferret/ticket/1579