Mercurial > octave-nkf
comparison scripts/plot/legend.m @ 11940:0d7e145c1ca4 release-3-0-x
fix order of legends
author | Rob Mahurin <rob@utk.edu> |
---|---|
date | Wed, 25 Feb 2009 08:47:27 +0100 |
parents | f7d4376f36d5 |
children |
comparison
equal
deleted
inserted
replaced
11939:a24565131108 | 11940:0d7e145c1ca4 |
---|---|
169 warning ("legend: plot data is empty; setting key labels has no effect"); | 169 warning ("legend: plot data is empty; setting key labels has no effect"); |
170 endif | 170 endif |
171 endif | 171 endif |
172 | 172 |
173 warned = false; | 173 warned = false; |
174 for i = nargs:-1:1 | 174 for i = 1:nargs |
175 arg = varargin{i}; | 175 arg = varargin{i}; |
176 if (ischar (arg)) | 176 if (ischar (arg)) |
177 while (k <= nkids | 177 while (k <= nkids |
178 && ! (strcmp (get (kids(k), "type"), "line") | 178 && ! (strcmp (get (kids(k), "type"), "line") |
179 || strcmp (get (kids(k), "type"), "surface") | 179 || strcmp (get (kids(k), "type"), "surface") |
199 | 199 |
200 endfunction | 200 endfunction |
201 | 201 |
202 %!demo | 202 %!demo |
203 %! close all; | 203 %! close all; |
204 %! plot(1:10, 1:10, 1:10, fliplr(1:10)); | 204 %! plot(1:10, 1:10, 'b', 1:10, fliplr(1:10), 'g'); |
205 %! title("incline is blue and decline is green"); | 205 %! title("incline is blue and decline is green"); |
206 %! legend({"I'm blue", "I'm green"}, "location", "east") | 206 %! legend({"I'm blue", "I'm green"}, "location", "east") |
207 | 207 |
208 %!demo | 208 %!demo |
209 %! close all; | 209 %! close all; |
212 %! legend({"hello world"}, "location", "northeastoutside") | 212 %! legend({"hello world"}, "location", "northeastoutside") |
213 | 213 |
214 %!demo | 214 %!demo |
215 %! close all; | 215 %! close all; |
216 %! labels = {}; | 216 %! labels = {}; |
217 %! color = 'bgryk'; | |
217 %! for i = 1:5 | 218 %! for i = 1:5 |
218 %! plot(1:100, i + rand(100,1)); hold on; | 219 %! plot(1:100, i + rand(100,1), color(i)); hold on; |
219 %! labels = {labels{:}, strcat("Signal ", num2str(i))}; | 220 %! labels = {labels{:}, strcat("Signal ", num2str(i))}; |
220 %! endfor; hold off; | 221 %! endfor; hold off; |
221 %! title("Signals with random offset and uniform noise") | 222 %! title("Signals with random offset and uniform noise") |
222 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]"); | 223 %! xlabel("Sample Nr [k]"); ylabel("Amplitude [V]"); |
223 %! legend(labels, "location", "southoutside") | 224 %! legend(labels, "location", "southoutside") |