Mercurial > octave
changeset 22319:1ddb53b6ad30
Add support for setting "(xy)axislocation" to "origin" (bug #48562).
* graphics.in.h: Add "origin" to the list of accepted values for
"(xy)axislocation". Deprecate "zero" (for Octave 4.6).
* __gnuplot_draw_axes__.m: Add "origin" as a synonym for "zero".
pushed by Andreas Weber <andy.weber.aw@gmail.com>
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 16 Aug 2016 23:28:09 +0200 |
parents | 0e8c36397197 |
children | c563396c5bf1 |
files | NEWS libinterp/corefcn/graphics.in.h scripts/plot/util/private/__gnuplot_draw_axes__.m |
diffstat | 3 files changed, 28 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Aug 16 13:14:13 2016 -0700 +++ b/NEWS Tue Aug 16 23:28:09 2016 +0200 @@ -1,6 +1,10 @@ Summary of important user-visible changes for version 4.2: --------------------------------------------------------- + ** The value "zero" for the axes properties "xaxislocation" and + "yaxislocation" has been deprecated and will be removed from + Octave 4.6. Use "origin" instead. + ** The parser has been extended to accept, but ignore, underscore characters in numbers. This facilitates writing more legible code by using '_' as a thousands separator or to group nibbles into bytes
--- a/libinterp/corefcn/graphics.in.h Tue Aug 16 13:14:13 2016 -0700 +++ b/libinterp/corefcn/graphics.in.h Tue Aug 16 23:28:09 2016 +0200 @@ -3874,7 +3874,8 @@ // FIXME: uicontextmenu should be moved here. radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters" array_property view u , default_axes_view () - radio_property xaxislocation u , "{bottom}|top|zero" + // FIXME: Remove "zero" in 4.6 + radio_property xaxislocation u , "{bottom}|top|origin|zero" color_property xcolor m , color_values (0.15, 0.15, 0.15) radio_property xcolormode , "{auto}|manual" radio_property xdir u , "{normal}|reverse" @@ -3891,7 +3892,8 @@ radio_property xticklabelmode u , "{auto}|manual" double_property xticklabelrotation , 0.0 radio_property xtickmode u , "{auto}|manual" - radio_property yaxislocation u , "{left}|right|zero" + // FIXME: Remove "zero" in 4.6 + radio_property yaxislocation u , "{left}|right|origin|zero" color_property ycolor m , color_values (0.15, 0.15, 0.15) radio_property ycolormode , "{auto}|manual" radio_property ydir u , "{normal}|reverse" @@ -3982,12 +3984,22 @@ void update_layer (void) { update_axes_layout (); } void update_yaxislocation (void) { + // FIXME: Remove warning with "zero" in 4.6 + if (yaxislocation_is ("zero")) + warning_with_id ("Octave:deprecated-property", + "Setting 'yaxislocation' to 'zero' is deprecated, " + "set to 'origin' instead."); sync_positions (); update_axes_layout (); update_ylabel_position (); } void update_xaxislocation (void) { + // FIXME: Remove warning with "zero" in 4.6 + if (xaxislocation_is ("zero")) + warning_with_id ("Octave:deprecated-property", + "Setting 'xaxislocation' to 'zero' is deprecated, " + "set to 'origin' instead."); sync_positions (); update_axes_layout (); update_xlabel_position ();
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m Tue Aug 16 13:14:13 2016 -0700 +++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m Tue Aug 16 23:28:09 2016 +0200 @@ -268,7 +268,7 @@ else xaxisloc = "x"; xaxisloc_using = "x1"; - if (strcmp (axis_obj.xaxislocation, "zero")) + if (any (strcmp (axis_obj.xaxislocation, {"origin", "zero"}))) # FIXME: Remove "zero" in 4.6 fputs (plot_stream, "set xzeroaxis;\n"); endif endif @@ -278,7 +278,7 @@ else yaxisloc = "y"; yaxisloc_using = "y1"; - if (strcmp (axis_obj.yaxislocation, "zero")) + if (any (strcmp (axis_obj.yaxislocation, {"origin", "zero"}))) # FIXME: Remove "zero" in 4.6 fputs (plot_stream, "set yzeroaxis;\n"); endif endif @@ -1447,7 +1447,7 @@ maybe_do_x2tick_mirror (plot_stream, axis_obj) elseif (strcmp (axis_obj.xaxislocation, "bottom")) maybe_do_xtick_mirror (plot_stream, axis_obj) - else # xaxislocation == zero + else # xaxislocation == "origin" or "zero" fprintf (plot_stream, "unset x2tics; set xtics %s nomirror\n", axis_obj.tickdir); endif @@ -1458,17 +1458,17 @@ maybe_do_x2tick_mirror (plot_stream, axis_obj) elseif (strcmp (axis_obj.xaxislocation, "bottom")) maybe_do_xtick_mirror (plot_stream, axis_obj) - else # xaxislocation == zero + else # xaxislocation == "origin" or "zero" maybe_do_xtick_mirror (plot_stream, axis_obj) endif - else # yaxislocation == zero + else # yaxislocation == "origin" or "zero" fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n", axis_obj.tickdir); if (strcmp (axis_obj.xaxislocation, "top")) maybe_do_x2tick_mirror (plot_stream, axis_obj) elseif (strcmp (axis_obj.xaxislocation, "bottom")) maybe_do_xtick_mirror (plot_stream, axis_obj) - else # xaxislocation == zero + else # xaxislocation == "origin" or "zero" maybe_do_xtick_mirror (plot_stream, axis_obj) fprintf (plot_stream, "unset y2tics; set ytics %s nomirror\n", axis_obj.tickdir); @@ -1793,10 +1793,10 @@ arrow (4, obj.ycolor, obj.linewidth, [1,0,0], [1,1,0]); endif - if (strcmp (obj.xaxislocation, "zero")) + if (any (strcmp (obj.xaxislocation, {"origin", "zero"}))) # FIXME: Remove "zero" in 4.6 idx = zeroaxis (idx, obj.xcolor, "x"); endif - if (strcmp (obj.yaxislocation, "zero")) + if (any (strcmp (obj.yaxislocation, {"origin", "zero"}))) # FIXME: Remove "zero" in 4.6 idx = zeroaxis (idx, obj.ycolor, "y"); endif @@ -2173,7 +2173,7 @@ obj.xcolor, "x", plot_stream, true, "border", "", "", fontname, fontspec, obj.ticklabelinterpreter, obj.xscale, obj.xsgn, gnuplot_term); - elseif (strcmp (obj.xaxislocation, "zero")) + elseif (any (strcmp (obj.xaxislocation, {"origin", "zero"}))) # FIXME: Remove "zero" in 4.6 do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x", plot_stream, true, "axis", obj.tickdir, ticklength, fontname, fontspec, @@ -2201,7 +2201,7 @@ obj.ycolor, "y", plot_stream, ymirror, "border", "", "", fontname, fontspec, obj.ticklabelinterpreter, obj.yscale, obj.ysgn, gnuplot_term); - elseif (strcmp (obj.yaxislocation, "zero")) + elseif (any (strcmp (obj.yaxislocation, {"origin", "zero"}))) # FIXME: Remove "zero" in 4.6 do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, "axis", obj.tickdir, ticklength, fontname, fontspec,