changeset 8343:9f34f7636fe0

legend.m: Correct ording of legend labels.
author Ben Abbott <bpabbott@mac.com>
date Mon, 24 Nov 2008 12:27:03 -0500
parents 39b9f7dfbf4a
children b5f10b123440
files scripts/ChangeLog scripts/plot/legend.m
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Nov 24 11:05:25 2008 +0100
+++ b/scripts/ChangeLog	Mon Nov 24 12:27:03 2008 -0500
@@ -1,3 +1,7 @@
+2008-11-24  Ben Abbott <bpabbott@mac.com>
+
+	* plot/legend.m: Correct ording of legend labels.
+
 2008-11-21  Radek Salac  <salac.r@gmail.com>
 
 	* sparse/cgs.m, sparse/treelayout.m: New functions.
--- a/scripts/plot/legend.m	Mon Nov 24 11:05:25 2008 +0100
+++ b/scripts/plot/legend.m	Mon Nov 24 12:27:03 2008 -0500
@@ -165,11 +165,13 @@
 	nargs = numel (varargin);
       endif
     elseif (iscellstr (arg))
-      varargin = arg;
+      varargin = fliplr (arg);
       nargs = numel (varargin);
     else
       error ("legend: expecting argument to be a character string");
     endif
+  else
+    varargin(1:nargs) = fliplr (varargin(1:nargs));
   endif
 
   if (nargs > 0)
@@ -231,6 +233,12 @@
 
 %!demo
 %! close all;
+%! plot(1:10, 1:10, 1:10, fliplr(1:10));
+%! title("incline is blue and decline is green");
+%! legend({"I'm blue", "I'm green"}, "location", "east")
+
+%!demo
+%! close all;
 %! plot(1:10, 1:10);
 %! title("a very long label can sometimes cause problems");
 %! legend({"hello world"}, "location", "northeastoutside")