Mercurial > hg > octave-terminal
changeset 10770:84c35a483d1f
Support 'hold all' (Feature Request #30336)
author | David Bateman <dbateman@free.fr> |
---|---|
date | Wed, 07 Jul 2010 20:21:28 +0200 |
parents | 569823598028 |
children | 82d9efde7e96 |
files | scripts/ChangeLog scripts/plot/__next_line_color__.m scripts/plot/__next_line_style__.m scripts/plot/hold.m scripts/plot/newplot.m src/ChangeLog src/graphics.h.in |
diffstat | 7 files changed, 39 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,13 @@ +2010-07-07 David Bateman <dbateman@free.fr> + + * __next_line_color__.m: Allow conditional initialisation of the + color_rotation variable. + * __next_line_style__.m: Allow conditional initialisation of the + style_rotation variable. + * hold.m: Support "hold all". + * newplot.m: Conditionally initialisation the line style and color + based on the __hold_all__ axes property. + 2010-07-04 Soren Hauberg <hauberg@gmail.com> * polynomial/deconv.m: ensure that the orientation of the third
--- a/scripts/plot/__next_line_color__.m +++ b/scripts/plot/__next_line_color__.m @@ -32,10 +32,12 @@ persistent color_index; if (nargin < 2) - if (nargin == 1 && reset) - color_rotation = get (gca (), "colororder"); - num_colors = rows (color_rotation); - color_index = 1; + if (nargin == 1) + if (reset || isempty (color_rotation)) + color_rotation = get (gca (), "colororder"); + num_colors = rows (color_rotation); + color_index = 1; + endif elseif (! isempty (color_rotation)) rgb = color_rotation(color_index,:); if (++color_index > num_colors)
--- a/scripts/plot/__next_line_style__.m +++ b/scripts/plot/__next_line_style__.m @@ -38,7 +38,7 @@ elseif (++style_index > num_styles) style_index = 1; endif - elseif (reset) + elseif (reset || isempty (style_rotation)) style_rotation = strsplit (get (gca (), "linestyleorder"), "|"); num_styles = length (style_rotation); style_index = 1;
--- a/scripts/plot/hold.m +++ b/scripts/plot/hold.m @@ -29,6 +29,11 @@ ## Retain plot data and settings so that subsequent plot commands are displayed ## on a single graph. ## +## @item hold all +## Retain plot line color, line style, data and settings so that subsequent +## plot commands are displayed on a single graph with the next line color and +## style. +## ## @item hold off ## Clear plot and restore default graphics settings before each new plot ## command. (default). @@ -57,6 +62,7 @@ nargs = numel (varargin); endif + hold_all = false; if (nargs == 0) turn_hold_off = ishold (ax); elseif (nargs == 1) @@ -64,6 +70,9 @@ if (ischar (state)) if (strcmpi (state, "off")) turn_hold_off = true; + elseif (strcmpi (state, "all")) + turn_hold_off = false; + hold_all = true; elseif (strcmpi (state, "on")) turn_hold_off = false; else @@ -80,6 +89,7 @@ set (ax, "nextplot", "add"); set (fig, "nextplot", "add"); endif + set (ax, "__hold_all__", hold_all); endfunction
--- a/scripts/plot/newplot.m +++ b/scripts/plot/newplot.m @@ -26,8 +26,6 @@ function newplot () if (nargin == 0) - __next_line_color__ (true); - __next_line_style__ (true); cf = gcf (); fnp = get (cf, "nextplot"); switch (fnp) @@ -43,6 +41,13 @@ endswitch ca = gca (); anp = get (ca, "nextplot"); + if (strcmp (get (ca, "__hold_all__"), "off")) + __next_line_color__ (true); + __next_line_style__ (true); + else + __next_line_color__ (false); + __next_line_style__ (false); + endif switch (anp) case "new" case "add"
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-07-07 David Bateman <dbateman@free.fr> + + * graphics.h.in (axes): Add hidden property __hold_all. + 2010-07-07 Jaroslav Hajek <highegg@gmail.com> * ov-class.h (octave_class::map): Turn to octave_map.
--- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -2993,6 +2993,7 @@ radio_property yaxislocation , "{left}|right|zero" radio_property xaxislocation , "{bottom}|top|zero" array_property view u , Matrix () + bool_property __hold_all__ h , "off" radio_property nextplot , "new|add|replacechildren|{replace}" array_property outerposition u , default_axes_outerposition () radio_property activepositionproperty , "{outerposition}|position"