comparison scripts/plot/legend.m @ 7148:735086cfd405

[project @ 2007-11-09 18:01:44 by jwe]
author jwe
date Fri, 09 Nov 2007 18:01:45 +0000
parents 1c5b2b5b58ba
children 3422f39573b1 03dab4d76975
comparison
equal deleted inserted replaced
7147:fdb3840cec66 7148:735086cfd405
57 ## can be appended to any location string 57 ## can be appended to any location string
58 ## @end multitable 58 ## @end multitable
59 ## 59 ##
60 ## Some specific functions are directly available using @var{func}: 60 ## Some specific functions are directly available using @var{func}:
61 ## 61 ##
62 ## @table @code 62 ## @table @asis
63 ## @item "show" 63 ## @item "show"
64 ## Show legends from the plot 64 ## Show legends from the plot
65 ## @item "hide" 65 ## @item "hide"
66 ## @itemx off 66 ## @itemx "off"
67 ## Hide legends from the plot 67 ## Hide legends from the plot
68 ## @item "boxon" 68 ## @item "boxon"
69 ## Draw a box around legends 69 ## Draw a box around legends
70 ## @item "boxoff" 70 ## @item "boxoff"
71 ## Withdraw the box around legends 71 ## Withdraw the box around legends
156 endif 156 endif
157 157
158 if (nargs > 0) 158 if (nargs > 0)
159 have_data = false; 159 have_data = false;
160 for i = 1:nkids 160 for i = 1:nkids
161 if (strcmp (get (kids(k), "type"), "line")) 161 if (strcmp (get (kids(k), "type"), "line")
162 || strcmp (get (kids(k), "type"), "surface")
163 || strcmp (get (kids(k), "type"), "patch"))
162 have_data = true; 164 have_data = true;
163 break; 165 break;
164 endif 166 endif
165 endfor 167 endfor
166 if (! have_data) 168 if (! have_data)
170 172
171 warned = false; 173 warned = false;
172 for i = 1:nargs 174 for i = 1:nargs
173 arg = varargin{i}; 175 arg = varargin{i};
174 if (ischar (arg)) 176 if (ischar (arg))
175 while (k <= nkids && ! strcmp (get (kids(k), "type"), "line")) 177 while (k <= nkids
178 && ! (strcmp (get (kids(k), "type"), "line")
179 || strcmp (get (kids(k), "type"), "surface")
180 || strcmp (get (kids(k), "type"), "patch")))
176 k++; 181 k++;
177 endwhile 182 endwhile
178 if (k <= nkids) 183 if (k <= nkids)
179 set (kids(k), "keylabel", arg); 184 set (kids(k), "keylabel", arg);
180 turn_on_legend = true; 185 turn_on_legend = true;