diff 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
line wrap: on
line diff
--- a/scripts/plot/legend.m	Wed Feb 25 08:40:31 2009 +0100
+++ b/scripts/plot/legend.m	Wed Feb 25 08:47:27 2009 +0100
@@ -171,7 +171,7 @@
   endif
 
   warned = false;
-  for i = nargs:-1:1
+  for i = 1:nargs
     arg = varargin{i};
     if (ischar (arg))
       while (k <= nkids
@@ -201,7 +201,7 @@
 
 %!demo
 %! close all;
-%! plot(1:10, 1:10, 1:10, fliplr(1:10));
+%! plot(1:10, 1:10, 'b', 1:10, fliplr(1:10), 'g');
 %! title("incline is blue and decline is green");
 %! legend({"I'm blue", "I'm green"}, "location", "east")
 
@@ -214,8 +214,9 @@
 %!demo
 %! close all;
 %! labels = {};
+%! color = 'bgryk';
 %! for i = 1:5
-%!     plot(1:100, i + rand(100,1)); hold on;
+%!     plot(1:100, i + rand(100,1), color(i)); hold on;
 %!     labels = {labels{:}, strcat("Signal ", num2str(i))};
 %! endfor; hold off;
 %! title("Signals with random offset and uniform noise")