[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch to add axis position property
From: |
Peter Gustafson |
Subject: |
Re: Patch to add axis position property |
Date: |
Fri, 10 Aug 2007 13:53:57 -0400 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20070806) |
John W. Eaton wrote:
>
> OK. If you'll fix a few things, I think I can apply this patch.
I think this final patch addresses the stylistic problems (especially
those very poor fputs-sprintf, don't know how I missed that) and
includes the ChangeLog. Thanks,
Pete
Index: ChangeLog
===================================================================
RCS file: /cvs/octave/ChangeLog,v
retrieving revision 1.631
diff -c -r1.631 ChangeLog
*** ChangeLog 26 Jul 2007 18:44:06 -0000 1.631
--- ChangeLog 10 Aug 2007 17:39:35 -0000
***************
*** 1,3 ****
--- 1,11 ----
+ 2007-08-10 Peter A. Gustafson <address@hidden>
+
+ * src/graphics.h, src/graphics.cc: Add axes properties for
+ [xy]axislocation.
+ * scripts/plot/__go_draw_axes__.m: Add axes position to the
+ usingclause, use axes position in each appropriate gnuplot set
+ statement.
+
2007-07-26 John W. Eaton <address@hidden>
* configure.in: Also look for glpk/glpk.h.
Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.32
diff -c -r1.32 __go_draw_axes__.m
*** scripts/plot/__go_draw_axes__.m 24 Jul 2007 19:02:27 -0000 1.32
--- scripts/plot/__go_draw_axes__.m 10 Aug 2007 17:39:35 -0000
***************
*** 117,132 ****
endif
endif
if (strcmpi (axis_obj.xgrid, "on"))
! fputs (plot_stream, "set grid xtics;\n");
else
! fputs (plot_stream, "set grid noxtics;\n");
endif
if (strcmpi (axis_obj.ygrid, "on"))
! fputs (plot_stream, "set grid ytics;\n");
else
! fputs (plot_stream, "set grid noytics;\n");
endif
if (strcmpi (axis_obj.zgrid, "on"))
--- 117,147 ----
endif
endif
+ if (strcmpi(axis_obj.xaxislocation,"top"))
+ xaxisloc = "x2";
+ xaxisloc_using = "x2";
+ else
+ xaxisloc = "x";
+ xaxisloc_using = "x1";
+ endif
+ if (strcmpi(axis_obj.yaxislocation,"right"))
+ yaxisloc = "y2";
+ yaxisloc_using = "y2";
+ else
+ yaxisloc = "y";
+ yaxisloc_using = "y1";
+ endif
+
if (strcmpi (axis_obj.xgrid, "on"))
! fprintf (plot_stream, "set grid %stics;\n", xaxisloc);
else
! fprintf (plot_stream, "set grid no%stics;\n", xaxisloc);
endif
if (strcmpi (axis_obj.ygrid, "on"))
! fprintf (plot_stream, "set grid %stics;\n", yaxisloc);
else
! fprintf (plot_stream, "set grid no%stics;\n", yaxisloc);
endif
if (strcmpi (axis_obj.zgrid, "on"))
***************
*** 136,152 ****
endif
if (strcmpi (axis_obj.xminorgrid, "on"))
! fputs (plot_stream, "set mxtics 5;\n");
! fputs (plot_stream, "set grid mxtics;\n");
else
! fputs (plot_stream, "set grid nomxtics;\n");
endif
if (strcmpi (axis_obj.yminorgrid, "on"))
! fputs (plot_stream, "set mytics 5;\n");
! fputs (plot_stream, "set grid mytics;\n");
else
! fputs (plot_stream, "set grid nomytics;\n");
endif
if (strcmpi (axis_obj.zminorgrid, "on"))
--- 151,167 ----
endif
if (strcmpi (axis_obj.xminorgrid, "on"))
! fprintf (plot_stream, "set m%stics 5;\n", xaxisloc);
! fprintf (plot_stream, "set grid m%stics;\n", xaxisloc);
else
! fprintf (plot_stream, "set grid nom%stics;\n", xaxisloc);
endif
if (strcmpi (axis_obj.yminorgrid, "on"))
! fprintf (plot_stream, "set m%stics 5;\n", yaxisloc);
! fprintf (plot_stream, "set grid m%stics;\n", yaxisloc);
else
! fprintf (plot_stream, "set grid nom%stics;\n", yaxisloc);
endif
if (strcmpi (axis_obj.zminorgrid, "on"))
***************
*** 160,175 ****
xlogscale = strcmpi (axis_obj.xscale, "log");
if (xlogscale)
! fputs (plot_stream, "set logscale x;\n");
else
! fputs (plot_stream, "unset logscale x;\n");
endif
ylogscale = strcmpi (axis_obj.yscale, "log");
if (ylogscale)
! fputs (plot_stream, "set logscale y;\n");
else
! fputs (plot_stream, "unset logscale y;\n");
endif
zlogscale = strcmpi (axis_obj.zscale, "log");
--- 175,190 ----
xlogscale = strcmpi (axis_obj.xscale, "log");
if (xlogscale)
! fprintf (plot_stream, "set logscale %s;\n", xaxisloc);
else
! fprintf (plot_stream, "unset logscale %s;\n", xaxisloc);
endif
ylogscale = strcmpi (axis_obj.yscale, "log");
if (ylogscale)
! fprintf (plot_stream, "set logscale %s;\n", yaxisloc);
else
! fprintf (plot_stream, "unset logscale %s;\n", yaxisloc);
endif
zlogscale = strcmpi (axis_obj.zscale, "log");
***************
*** 397,403 ****
[ymin, ymax, yminp] = get_data_limits (ymin, ymax, yminp, ydat);
endif
data{data_idx} = [xdat, ydat]';
! usingclause{data_idx} = "using ($1):($2)";
endif
endif
if (! (have_newer_gnuplot || isempty (with)))
--- 412,419 ----
[ymin, ymax, yminp] = get_data_limits (ymin, ymax, yminp, ydat);
endif
data{data_idx} = [xdat, ydat]';
! usingclause{data_idx} = sprintf("using ($1):($2) axes %s%s",
! xaxisloc_using, yaxisloc_using);
endif
endif
if (! (have_newer_gnuplot || isempty (with)))
***************
*** 620,626 ****
else
xdir = "noreverse";
endif
! fprintf (plot_stream, "set xrange [%g:%g] %s;\n", xlim, xdir);
if (yautoscale && have_data)
ylim = get_axis_limits (ymin, ymax, yminp, ylogscale);
--- 636,642 ----
else
xdir = "noreverse";
endif
! fprintf (plot_stream, "set %srange [%g:%g] %s;\n", xaxisloc, xlim, xdir);
if (yautoscale && have_data)
ylim = get_axis_limits (ymin, ymax, yminp, ylogscale);
***************
*** 633,639 ****
else
ydir = "noreverse";
endif
! fprintf (plot_stream, "set yrange [%g:%g] %s;\n", ylim, ydir);
if (nd == 3)
if (zautoscale && have_data)
--- 649,655 ----
else
ydir = "noreverse";
endif
! fprintf (plot_stream, "set %srange [%g:%g] %s;\n", yaxisloc, ylim, ydir);
if (nd == 3)
if (zautoscale && have_data)
***************
*** 997,1006 ****
endfunction
function do_tics (obj, plot_stream)
! do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
! "x", plot_stream);
! do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
! "y", plot_stream);
do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel,
"z", plot_stream);
endfunction
--- 1013,1040 ----
endfunction
function do_tics (obj, plot_stream)
! if (strcmp(obj.xaxislocation,"top"))
! do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
! "x2", plot_stream);
! do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
! "x", plot_stream);
! else
! do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
! "x", plot_stream);
! do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
! "x2", plot_stream);
! endif
! if (strcmp(obj.yaxislocation,"right"))
! do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
! "y2", plot_stream);
! do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
! "y", plot_stream);
! else
! do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
! "y", plot_stream);
! do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
! "y2", plot_stream);
! endif
do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel,
"z", plot_stream);
endfunction
Index: src/graphics.cc
===================================================================
RCS file: /cvs/octave/src/graphics.cc,v
retrieving revision 1.23
diff -c -r1.23 graphics.cc
*** src/graphics.cc 24 Jul 2007 19:02:27 -0000 1.23
--- src/graphics.cc 10 Aug 2007 17:39:35 -0000
***************
*** 975,980 ****
--- 975,982 ----
xdir ("normal"),
ydir ("normal"),
zdir ("normal"),
+ xaxislocation ("bottom"),
+ yaxislocation ("left"),
view (),
visible ("on"),
nextplot ("replace"),
***************
*** 1162,1167 ****
--- 1164,1173 ----
ydir = val;
else if (name.compare ("zdir"))
zdir = val;
+ else if (name.compare ("xaxislocation"))
+ xaxislocation = val;
+ else if (name.compare ("yaxislocation"))
+ yaxislocation = val;
else if (name.compare ("view"))
view = val;
else if (name.compare ("visible"))
***************
*** 1229,1234 ****
--- 1235,1242 ----
xdir = "normal";
ydir = "normal";
zdir = "normal";
+ xaxislocation = "left";
+ yaxislocation = "bottom";
Matrix tview (1, 2, 0.0);
tview(1) = 90;
***************
*** 1317,1322 ****
--- 1325,1332 ----
m.assign ("xdir", xdir);
m.assign ("ydir", ydir);
m.assign ("zdir", zdir);
+ m.assign ("xaxislocation", xaxislocation);
+ m.assign ("yaxislocation", yaxislocation);
m.assign ("view", view);
m.assign ("visible", visible);
m.assign ("nextplot", nextplot);
***************
*** 1440,1445 ****
--- 1450,1459 ----
retval = ydir;
else if (name.compare ("zdir"))
retval = zdir;
+ else if (name.compare ("xaxislocation"))
+ retval = xaxislocation;
+ else if (name.compare ("yaxislocation"))
+ retval = yaxislocation;
else if (name.compare ("view"))
retval = view;
else if (name.compare ("visible"))
***************
*** 1537,1542 ****
--- 1551,1558 ----
m["xdir"] = "normal";
m["ydir"] = "normal";
m["zdir"] = "normal";
+ m["xaxislocation"] = "bottom";
+ m["yaxislocation"] = "left";
Matrix tview (1, 2, 0.0);
tview(1) = 90;
Index: src/graphics.h
===================================================================
RCS file: /cvs/octave/src/graphics.h,v
retrieving revision 1.7
diff -c -r1.7 graphics.h
*** src/graphics.h 24 Jul 2007 19:02:27 -0000 1.7
--- src/graphics.h 10 Aug 2007 17:39:35 -0000
***************
*** 1209,1214 ****
--- 1209,1216 ----
OCTAVE_GRAPHICS_PROPERTY (octave_value, xdir);
OCTAVE_GRAPHICS_PROPERTY (octave_value, ydir);
OCTAVE_GRAPHICS_PROPERTY (octave_value, zdir);
+ OCTAVE_GRAPHICS_PROPERTY (octave_value, xaxislocation);
+ OCTAVE_GRAPHICS_PROPERTY (octave_value, yaxislocation);
OCTAVE_GRAPHICS_PROPERTY (octave_value, view);
OCTAVE_GRAPHICS_PROPERTY (octave_value, visible);
OCTAVE_GRAPHICS_PROPERTY (octave_value, nextplot);
- Patch to add axis position property, Peter Gustafson, 2007/08/09
- Re: Patch to add axis position property, Shai Ayal, 2007/08/09
- Re: Patch to add axis position property, John W. Eaton, 2007/08/09
- Re: Patch to add axis position property, Peter Gustafson, 2007/08/09
- Re: Patch to add axis position property, John W. Eaton, 2007/08/09
- Re: Patch to add axis position property, John W. Eaton, 2007/08/09
- Re: Patch to add axis position property, Peter Gustafson, 2007/08/10
- Re: Patch to add axis position property, John W. Eaton, 2007/08/10
- Re: Patch to add axis position property,
Peter Gustafson <=
- Re: Patch to add axis position property, John W. Eaton, 2007/08/10