Mercurial > hg > octave-lyh
changeset 7206:6e4ceeeb1940
[project @ 2007-11-27 22:40:20 by jwe]
author | jwe |
---|---|
date | Tue, 27 Nov 2007 22:40:20 +0000 |
parents | f3d508351e49 |
children | 71c03c7239fb |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/plotyy.m src/ChangeLog src/error.cc |
diffstat | 5 files changed, 67 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,12 @@ +2007-11-27 David Bateman <dbateman@free.fr> + + * plot/__go_draw_axes__.m: Add nomirror to "set ytics" and "set + y2tics" in the case of a plotyy plot. + * plot/plotyy.m: ensure the position property is set correct for + the second axis, by setting it after the plot itself. In the case + of a plot that returns multiple handles, base the color selection + on the first. + 2007-11-27 Kai Habel <kai.habel@gmx.de> * plot/__go_draw_axes__.m: Set quadrilateral color according to
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -37,12 +37,14 @@ pos = axis_obj.outerposition; endif + ymirror = true; if (! isempty (axis_obj.position)) pos = axis_obj.position; fprintf (plot_stream, "set tmargin 3;\n"); fprintf (plot_stream, "set bmargin 3;\n"); fprintf (plot_stream, "set lmargin 10;\n"); fprintf (plot_stream, "set rmargin 10;\n"); + ymirror = false; endif if (! strcmp (axis_obj.__colorbar__, "none")) @@ -209,7 +211,7 @@ fputs (plot_stream, "set grid nomztics;\n"); endif - do_tics (axis_obj, plot_stream); + do_tics (axis_obj, plot_stream, ymirror); xlogscale = strcmpi (axis_obj.xscale, "log"); if (xlogscale) @@ -1532,34 +1534,34 @@ endfunction -function do_tics (obj, plot_stream) +function do_tics (obj, plot_stream, ymirror) if (strcmpi (obj.xaxislocation, "top")) do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, - obj.xcolor, "x2", plot_stream); + obj.xcolor, "x2", plot_stream, true); do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, - obj.xcolor, "x", plot_stream); + obj.xcolor, "x", plot_stream, true); else do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, - obj.xcolor, "x", plot_stream); + obj.xcolor, "x", plot_stream, true); do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, - obj.xcolor, "x2", plot_stream); + obj.xcolor, "x2", plot_stream, true); endif if (strcmpi (obj.yaxislocation, "right")) do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, - obj.ycolor, "y2", plot_stream); + obj.ycolor, "y2", plot_stream, ymirror); do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, - obj.ycolor, "y", plot_stream); + obj.ycolor, "y", plot_stream, ymirror); else do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, - obj.ycolor, "y", plot_stream); + obj.ycolor, "y", plot_stream, ymirror); do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, - obj.ycolor, "y2", plot_stream); + obj.ycolor, "y2", plot_stream, ymirror); endif do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel, - obj.zcolor, "z", plot_stream); + obj.zcolor, "z", plot_stream, true); endfunction -function do_tics_1 (ticmode, tics, labelmode, labels, color, ax, plot_stream) +function do_tics_1 (ticmode, tics, labelmode, labels, color, ax, plot_stream, mirror) colorspec = get_text_colorspec (color); if (strcmpi (ticmode, "manual")) if (isempty (tics)) @@ -1573,7 +1575,11 @@ ntics = numel (tics); nlabels = numel (labels); fprintf (plot_stream, "set format %s \"%%s\";\n", ax); - fprintf (plot_stream, "set %stics %s (", ax, colorspec); + if (mirror) + fprintf (plot_stream, "set %stics %s (", ax, colorspec); + else + fprintf (plot_stream, "set %stics nomirror %s (", ax, colorspec); + endif for i = 1:ntics fprintf (plot_stream, " \"%s\" %g", labels(k++), tics(i)) if (i < ntics) @@ -1589,13 +1595,21 @@ endif else fprintf (plot_stream, "set format %s \"%%g\";\n", ax); - fprintf (plot_stream, "set %stics (", ax); + if (mirror) + fprintf (plot_stream, "set %stics (", ax); + else + fprintf (plot_stream, "set %stics nomirror (", ax); + endif fprintf (plot_stream, " %g,", tics(1:end-1)); fprintf (plot_stream, " %g);\n", tics(end)); endif else fprintf (plot_stream, "set format %s \"%%g\";\n", ax); - fprintf (plot_stream, "set %stics %s;\n", ax, colorspec); + if (mirror) + fprintf (plot_stream, "set %stics %s;\n", ax, colorspec); + else + fprintf (plot_stream, "set %stics nomirror %s;\n", ax, colorspec); + endif endif endfunction
--- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -102,18 +102,19 @@ xlim = [min([x1(:); x2(:)]), max([x1(:); x2(:)])]; h1 = feval (fun1, x1, y1); - set (ax(1), "ycolor", get (h1, "color")); + set (ax(1), "ycolor", get (h1(1), "color")); set (ax(1), "position", get (ax(1), "outerposition")); set (ax(1), "xlim", xlim); cf = gcf (); set (cf, "nextplot", "add"); - ax(2) = axes ("position", get (ax(1), "position")); + ax(2) = axes (); colors = get (ax(1), "colororder"); set (ax(2), "colororder", [colors(2:end,:); colors(1,:)]); h2 = feval (fun2, x2, y2); - set (ax(2), "ycolor", get (h2, "color")); + set (ax(2), "yaxislocation", "right"); + set (ax(2), "ycolor", get (h2(1), "color")); + set (ax(2), "position", get (ax(1), "outerposition")); set (ax(2), "xlim", xlim); - set (ax(2), "yaxislocation", "right"); endfunction
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -6,7 +6,10 @@ Insert MAYBE_DO_BREAKPOINT here. * error.cc (Fwarning): If setting state "all" to "error", leave - Octave:matlab-incompatible warning state unchanged. + Octave:matlab-incompatible and Octave:single-quote-string warning + states unchanged. + (warning_enabled): Allow individual warning states to override + "warning error all". * octave.cc (execute_eval_option_code, execute_command_line_file): Handle interrupts.
--- a/src/error.cc +++ b/src/error.cc @@ -620,7 +620,12 @@ retval = all_state; } else if (all_state == 2) - retval = 2; + { + if (id_state == 0) + retval= id_state; + else + retval = all_state; + } return retval; } @@ -1088,6 +1093,8 @@ if (arg1 == "error" && warning_options.contains ("identifier")) { + octave_idx_type n = 1; + Cell tid = warning_options.contents ("identifier"); Cell tst = warning_options.contents ("state"); @@ -1095,17 +1102,21 @@ { octave_value vid = tid(i); - if (vid.is_string () - && (vid.string_value () - == "Octave:matlab-incompatible")) + if (vid.is_string ()) { - id.resize (dim_vector (1, 2)); - st.resize (dim_vector (1, 2)); + std::string key = vid.string_value (); - id(1) = tid(i); - st(1) = tst(i); + if (key == "Octave:matlab-incompatible" + || key == "Octave:single-quote-string") + { + id.resize (dim_vector (1, n+1)); + st.resize (dim_vector (1, n+1)); - break; + id(n) = tid(i); + st(n) = tst(i); + + n++; + } } } }