changeset 11421:a451eb6f92b2

__plt__.m: Fix to allow inline legend keys. Bug 31991.
author Ben Abbott <bpabbott@mac.com>
date Tue, 28 Dec 2010 17:41:04 -0500
parents 466ba499eff5
children 3cae59b4c0f7
files scripts/ChangeLog scripts/plot/private/__plt__.m
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Dec 28 13:08:23 2010 -0800
+++ b/scripts/ChangeLog	Tue Dec 28 17:41:04 2010 -0500
@@ -1,3 +1,7 @@
+2010-12-28  Ben Abbott <bpabbott@mac.com>
+
+	* plot/private/__plt__.m: Fix to allow inline legend keys. Bug 31991.
+
 2010-12-28  Rik  <octave@nomad.inbox5.com>
 
 	* image/autumn.m, image/bone.m, image/cool.m, image/copper.m, 
--- a/scripts/plot/private/__plt__.m	Tue Dec 28 13:08:23 2010 -0800
+++ b/scripts/plot/private/__plt__.m	Tue Dec 28 17:41:04 2010 -0500
@@ -80,12 +80,12 @@
           endif
           if (y_set)
             tmp = __plt2__ (h, x, y, options, properties);
-            [hlgnd, tlgnd] = __plt_key__ (tmp, options);
+            [hlgnd, tlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd);
             properties = {};
             retval = [retval; tmp];
           else
             tmp = __plt1__ (h, x, options, properties);
-            [hlgnd, tlgnd] = __plt_key__ (tmp, options);
+            [hlgnd, tlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd);
             properties = {};
             retval = [retval; tmp];
           endif
@@ -98,7 +98,7 @@
         if (y_set)
           options = __pltopt__ (caller, {""});
           tmp = __plt2__ (h, x, y, options, properties);
-          [hlgnd, tlgnd] = __plt_key__ (tmp, options);
+          [hlgnd, tlgnd] = __plt_key__ (tmp, options, hlgnd, tlgnd);
           retval = [retval; tmp];
           x = next_arg;
           y_set = false;
@@ -123,9 +123,7 @@
 
 endfunction
 
-function [hlgnd, tlgnd] = __plt_key__ (h, options)
-  hlgnd = [];
-  tlgnd = {};
+function [hlgnd, tlgnd] = __plt_key__ (h, options, hlgnd, tlgnd)
   n = numel (h);
   if (numel (options) == 1)
     options = repmat (options(:), n, 1);
@@ -134,7 +132,7 @@
   for i = 1 : n
     key = options.key;
     if (! isempty (key))
-      hlgnd = [h(i), h(i)];
+      hlgnd = [hlgnd(:), h(i)];
       tlgnd = {tlgnd{:}, key};
     endif
   endfor