Mercurial > hg > octave-lyh
comparison scripts/plot/hold.m @ 10770:84c35a483d1f
Support 'hold all' (Feature Request #30336)
author | David Bateman <dbateman@free.fr> |
---|---|
date | Wed, 07 Jul 2010 20:21:28 +0200 |
parents | 95c3e38098bf |
children | 5074494f01a9 |
comparison
equal
deleted
inserted
replaced
10769:569823598028 | 10770:84c35a483d1f |
---|---|
27 ## @table @code | 27 ## @table @code |
28 ## @item hold on | 28 ## @item hold on |
29 ## Retain plot data and settings so that subsequent plot commands are displayed | 29 ## Retain plot data and settings so that subsequent plot commands are displayed |
30 ## on a single graph. | 30 ## on a single graph. |
31 ## | 31 ## |
32 ## @item hold all | |
33 ## Retain plot line color, line style, data and settings so that subsequent | |
34 ## plot commands are displayed on a single graph with the next line color and | |
35 ## style. | |
36 ## | |
32 ## @item hold off | 37 ## @item hold off |
33 ## Clear plot and restore default graphics settings before each new plot | 38 ## Clear plot and restore default graphics settings before each new plot |
34 ## command. (default). | 39 ## command. (default). |
35 ## | 40 ## |
36 ## @item hold | 41 ## @item hold |
55 ax = gca (); | 60 ax = gca (); |
56 fig = gcf (); | 61 fig = gcf (); |
57 nargs = numel (varargin); | 62 nargs = numel (varargin); |
58 endif | 63 endif |
59 | 64 |
65 hold_all = false; | |
60 if (nargs == 0) | 66 if (nargs == 0) |
61 turn_hold_off = ishold (ax); | 67 turn_hold_off = ishold (ax); |
62 elseif (nargs == 1) | 68 elseif (nargs == 1) |
63 state = varargin{1}; | 69 state = varargin{1}; |
64 if (ischar (state)) | 70 if (ischar (state)) |
65 if (strcmpi (state, "off")) | 71 if (strcmpi (state, "off")) |
66 turn_hold_off = true; | 72 turn_hold_off = true; |
73 elseif (strcmpi (state, "all")) | |
74 turn_hold_off = false; | |
75 hold_all = true; | |
67 elseif (strcmpi (state, "on")) | 76 elseif (strcmpi (state, "on")) |
68 turn_hold_off = false; | 77 turn_hold_off = false; |
69 else | 78 else |
70 error ("hold: invalid hold state"); | 79 error ("hold: invalid hold state"); |
71 endif | 80 endif |
78 set (ax, "nextplot", "replace"); | 87 set (ax, "nextplot", "replace"); |
79 else | 88 else |
80 set (ax, "nextplot", "add"); | 89 set (ax, "nextplot", "add"); |
81 set (fig, "nextplot", "add"); | 90 set (fig, "nextplot", "add"); |
82 endif | 91 endif |
92 set (ax, "__hold_all__", hold_all); | |
83 | 93 |
84 endfunction | 94 endfunction |
85 | 95 |
86 %!demo | 96 %!demo |
87 %! clf | 97 %! clf |