[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Proposed 'position' change
From: |
Daniel J Sebald |
Subject: |
Proposed 'position' change |
Date: |
Thu, 02 Oct 2008 23:16:50 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
I'm not sure exactly how 'position' in the Matryoska Tags is supposed to be
handled. Right now it appears to be forced to [0 0 1 1] inside
__go_draw_axes__.m. I'd like to propose the change in the attached patch.
The issue is that there isn't much control of the plot borders right now. I
wanted to do something like
pos = get(gca, 'position')
pos(1) = 0.1
set(gca, 'position', pos);
in order to get some subplots to line up nicely along all vertical borders.
Instead Octave does nothing in response to the position, for the reason
described above.
The change I propose is to define 'NaN' to mean "auto-compute" the borders. If
a position value is not NaN, gnuplot is instructed to use the specified margin. With
this interpretation and a default of [NaN NaN NaN NaN] the above sequence of commands
would produce
plot(...)
pos = get(gca, 'position')
pos = [NaN NaN NaN NaN]
pos(1) = 0.1
pos = [0.1 NaN NaN NaN]
which means that the left margin is fixed and the rest are auto-computed by
gnuplot. Basically, calling set() achieves what I wanted. (If the actual
values were returned in the pos array, that would still work too.)
There are a couple snags. First, does pos mean [lmargin bmargin rmargin
tmargin]? Or [lmargin bmargin width height]? The latter is problematic
because there really is no way of having auto-computed quantities for the right
and top borders. (Auto-computing a width makes little sense.) Second, it
would be nice if gnuplot could return the actual values so that the NaN isn't
needed. Would gnuplot indicating the actual quantities help in any way? E.g.,
gnuplot> show margin
lmargin is set to 0.15
bmargin is computed automatically (0.04)
rmargin is computed automatically (0.95)
tmargin is computed automatically (0.95)
which I could propose as a change to gnuplot?
Dan
--- graphics.cc 2008-02-06 04:46:10.000000000 -0600
+++ /usr/local/src/octave-cvs/octave/src/graphics.cc 2008-10-02
22:35:19.000000000 -0500
@@ -146,10 +146,10 @@
default_axes_position (void)
{
Matrix m (1, 4, 0.0);
- m(0) = 0.13;
- m(1) = 0.11;
- m(2) = 0.775;
- m(3) = 0.815;
+ m(0) = NaN;
+ m(1) = NaN;
+ m(2) = NaN;
+ m(3) = NaN;
return m;
}
--- /usr/local/share/octave/3.0.0+/m/plot/__go_draw_axes__.m 2008-01-30
21:13:52.000000000 -0600
+++ __go_draw_axes__.m 2008-10-02 17:59:03.000000000 -0500
@@ -32,7 +32,6 @@
= compare_versions (__gnuplot_version__ (), "4.0", ">");
## Set axis properties here?
- pos = [0, 0, 1, 1];
if (strcmp (axis_obj.activepositionproperty, "outerposition"))
ymirror = true;
if (! isempty (axis_obj.outerposition))
@@ -57,6 +56,29 @@
fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2));
fprintf (plot_stream, "set size %.15g, %.15g;\n", pos(3), pos(4));
+ if (! isempty (axis_obj.position))
+ if (isnan(axis_obj.position(1)))
+ fprintf (plot_stream, "set lmargin;\n");
+ else
+ fprintf (plot_stream, "set lmargin at screen %.15g;\n",
axis_obj.position(1));
+ endif
+ if (isnan(axis_obj.position(2)))
+ fprintf (plot_stream, "set bmargin;\n");
+ else
+ fprintf (plot_stream, "set bmargin at screen %.15g;\n",
axis_obj.position(2));
+ endif
+ if (isnan(axis_obj.position(3)))
+ fprintf (plot_stream, "set rmargin;\n");
+ else
+ fprintf (plot_stream, "set rmargin at screen %.15g;\n",
axis_obj.position(3));
+ endif
+ if (isnan(axis_obj.position(4)))
+ fprintf (plot_stream, "set tmargin;\n");
+ else
+ fprintf (plot_stream, "set tmargin at screen %.15g;\n",
axis_obj.position(4));
+ endif
+ endif
+
if (strcmpi (axis_obj.dataaspectratiomode, "manual"))
r = axis_obj.dataaspectratio;
fprintf (plot_stream, "set size ratio %.15g;\n", -r(2)/r(1));
- Proposed 'position' change,
Daniel J Sebald <=