Mercurial > hg > octave-nkf
changeset 6809:5e61f0bc0c27
[project @ 2007-08-10 18:41:33 by jwe]
author | jwe |
---|---|
date | Fri, 10 Aug 2007 18:41:34 +0000 |
parents | 64b2d6bcd54e |
children | 56a7de3f6451 |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m src/ChangeLog src/graphics.cc src/graphics.h |
diffstat | 5 files changed, 88 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2007-08-10 Peter A. Gustafson <petegus@umich.edu> + + * plot/__go_draw_axes__.m: Add axes position to the usingclause, + use axes position in each appropriate gnuplot set statement. + 2007-08-10 John W. Eaton <jwe@octave.org> * image/Makefile.in (DISTFILES): Also include $(IMAGES) in the list.
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -117,16 +117,31 @@ 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")) - fputs (plot_stream, "set grid xtics;\n"); + fprintf (plot_stream, "set grid %stics;\n", xaxisloc); else - fputs (plot_stream, "set grid noxtics;\n"); + fprintf (plot_stream, "set grid no%stics;\n", xaxisloc); endif if (strcmpi (axis_obj.ygrid, "on")) - fputs (plot_stream, "set grid ytics;\n"); + fprintf (plot_stream, "set grid %stics;\n", yaxisloc); else - fputs (plot_stream, "set grid noytics;\n"); + fprintf (plot_stream, "set grid no%stics;\n", yaxisloc); endif if (strcmpi (axis_obj.zgrid, "on")) @@ -136,17 +151,17 @@ endif if (strcmpi (axis_obj.xminorgrid, "on")) - fputs (plot_stream, "set mxtics 5;\n"); - fputs (plot_stream, "set grid mxtics;\n"); + fprintf (plot_stream, "set m%stics 5;\n", xaxisloc); + fprintf (plot_stream, "set grid m%stics;\n", xaxisloc); else - fputs (plot_stream, "set grid nomxtics;\n"); + fprintf (plot_stream, "set grid nom%stics;\n", xaxisloc); endif if (strcmpi (axis_obj.yminorgrid, "on")) - fputs (plot_stream, "set mytics 5;\n"); - fputs (plot_stream, "set grid mytics;\n"); + fprintf (plot_stream, "set m%stics 5;\n", yaxisloc); + fprintf (plot_stream, "set grid m%stics;\n", yaxisloc); else - fputs (plot_stream, "set grid nomytics;\n"); + fprintf (plot_stream, "set grid nom%stics;\n", yaxisloc); endif if (strcmpi (axis_obj.zminorgrid, "on")) @@ -160,16 +175,16 @@ xlogscale = strcmpi (axis_obj.xscale, "log"); if (xlogscale) - fputs (plot_stream, "set logscale x;\n"); + fprintf (plot_stream, "set logscale %s;\n", xaxisloc); else - fputs (plot_stream, "unset logscale x;\n"); + fprintf (plot_stream, "unset logscale %s;\n", xaxisloc); endif ylogscale = strcmpi (axis_obj.yscale, "log"); if (ylogscale) - fputs (plot_stream, "set logscale y;\n"); + fprintf (plot_stream, "set logscale %s;\n", yaxisloc); else - fputs (plot_stream, "unset logscale y;\n"); + fprintf (plot_stream, "unset logscale %s;\n", yaxisloc); endif zlogscale = strcmpi (axis_obj.zscale, "log"); @@ -397,14 +412,16 @@ [ymin, ymax, yminp] = get_data_limits (ymin, ymax, yminp, ydat); endif data{data_idx} = [xdat, ydat]'; - usingclause{data_idx} = "using ($1):($2)"; + usingclause{data_idx} = sprintf ("using ($1):($2) axes %s%s", + xaxisloc_using, yaxisloc_using); endif endif if (! (have_newer_gnuplot || isempty (with))) if (isempty (withclause{data_idx})) - withclause{data_idx} = sprintf("with %s", with); + withclause{data_idx} = sprintf ("with %s", with); else - withclause{data_idx} = sprintf("%s %s", withclause{data_idx}, with); + withclause{data_idx} = sprintf ("%s %s", withclause{data_idx}, + with); endif endif @@ -468,10 +485,10 @@ if (strncmp (obj.edgecolor, "none", 4)) color = [1, 1, 1]; elseif (strncmp (obj.edgecolor, "flat", 4)) - warning("\"flat\" for edgecolor not supported"); + warning ("\"flat\" for edgecolor not supported"); color = [0, 0, 0]; elseif (strncmp (obj.edgecolor, "interp", 6)) - warning("\"interp\" for edgecolor not supported"); + warning ("\"interp\" for edgecolor not supported"); color = [0, 0, 0]; else color = obj.edgecolor; @@ -620,7 +637,7 @@ else xdir = "noreverse"; endif - fprintf (plot_stream, "set xrange [%g:%g] %s;\n", xlim, xdir); + 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,7 +650,7 @@ else ydir = "noreverse"; endif - fprintf (plot_stream, "set yrange [%g:%g] %s;\n", ylim, ydir); + fprintf (plot_stream, "set %srange [%g:%g] %s;\n", yaxisloc, ylim, ydir); if (nd == 3) if (zautoscale && have_data) @@ -997,10 +1014,28 @@ 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); + if (strcmpi (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 (strcmpi (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
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2007-08-10 Peter A. Gustafson <petegus@umich.edu> + + * graphics.h, graphics.cc (axes::axes_properties): New properties, + xaxislocation and yaxislocation. + 2007-08-10 Kai Habel <kai.habel@gmx.de> * graphics.cc, graphics.h (patch): New class.
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -977,6 +977,8 @@ xdir ("normal"), ydir ("normal"), zdir ("normal"), + xaxislocation ("bottom"), + yaxislocation ("left"), view (), visible ("on"), nextplot ("replace"), @@ -1174,6 +1176,10 @@ 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")) @@ -1246,6 +1252,8 @@ xdir = "normal"; ydir = "normal"; zdir = "normal"; + xaxislocation = "left"; + yaxislocation = "bottom"; Matrix tview (1, 2, 0.0); tview(1) = 90; @@ -1336,6 +1344,8 @@ 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); @@ -1463,6 +1473,10 @@ 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")) @@ -1566,6 +1580,8 @@ m["xdir"] = "normal"; m["ydir"] = "normal"; m["zdir"] = "normal"; + m["xaxislocation"] = "bottom"; + m["yaxislocation"] = "left"; Matrix tview (1, 2, 0.0); tview(1) = 90;
--- a/src/graphics.h +++ b/src/graphics.h @@ -1211,6 +1211,8 @@ 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);