problem with figure size
Ben Abbott
bpabbott at mac.com
Thu Feb 19 18:07:30 CST 2009
On Feb 3, 2009, at 7:25 PM, Michael D. Godfrey wrote:
> After a recent update from current hg repository I found
> that figure sizing no longer works correctly for me.
> I use:
> print("haber_fig16.ps","-solid");
>
> The size of the PS graph is fixed by
> set(gx, "position", [0.13, 0.11, 0.775, 1.14]);
> This changes the size, but the bounding box is wrong.
> If I use "-debug" and edit the first line which is unconditionally:
> set terminal postscript enhanced size 8,6 portrait mono solid
> to the size that I intended, then I can recover the size that I got
> before the latest changes to gnuplot_drawnow.m
>
> The text in gnuplot_drawnow.m which generates this line has been
> changed
> as the diff below shows. Something in this change has introduced
> this
> error:
> Below is an excerpt form the diff of
> 14178 2009-01-30 16:48 gnuplot_drawnow.m
> and
> 12972 2009-01-16 00:07 gnuplot_drawnow.m
> 315,322c294,301
> < screensize = get (0, "screensize")(3:4);
> < t.normalized = screensize / t.pixels;
> < fig_size = position(3:4) * (t.pixels / t.(units));
> < fig_pos = position(1:2) * (t.pixels / t.(units));
> < fig_pos(1) = max (min (fig_pos(1), screensize(1)), 10);
> < fig_pos(2) = max (min (fig_pos(2), screensize(2)), 10);
> < fig_size(1) = max (min (fig_size(1), screensize(1)), 10-
> fig_pos(1));
> < fig_size(2) = max (min (fig_size(2), screensize(2)), 10-
> fig_pos(2));
> ---
>> t.normalized = get (0, "screensize")(3:4) / t.pixels;
>> fig_size = possize * (t.pixels / t.(units));
>> if (prod (fig_size) > 1e8)
>> warning ("gnuplot_drawnow: figure size is excessive. Reducing to
> 1024x768.")
>> fig_size = [1024, 768];
>> position = get (h, "position");
>> set (h, "position", [position(1:2), fig_size], "units", "pixels");
>> endif
> 325c304
>
> =======================================================
>
> I hope this information is sufficient. A few experiments with
> print("test.ps","-debug");
> will show that the generated gnuplot file is not correct with
> respect to
> the size values in the first line.
>
> Michael Godfrey
Michael,
I see a couple of obvious problems.
(1) The "position" property only applies to figure window location and
size.
(2) The units for "position" are normalized, so the value [0.13, 0.11,
0.775, 1.14] indicates the height of the axis box is 1.14 times taller
than the figure window.
The size for printed media is specified by "papersize" and
"paperposition". The subfunction, get_canvassize(h), is an attempt to
translate these properties into a canvas size for gnuplot.
Essentially, the canvas size is intended to be set equal to the size
of the plot area.
Is the explanation consistent with your observations?
Ben
More information about the Bug-octave
mailing list