changeset 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 a24565131108
children c2bfc6440e18
files scripts/ChangeLog scripts/plot/legend.m
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-24  Rob Mahurin  <rob@utk.edu>	
+
+	* plot/legend.m: Fix legend order.  Add explicit colors to demos.
+	From Marco Caliari <marco.caliari@univr.it>
+	
 2009-02-23  John W. Eaton  <jwe@octave.org>
 
 	* plot/fplot.m: Fix nargin check.
--- a/scripts/plot/legend.m
+++ b/scripts/plot/legend.m
@@ -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")