changeset 27463:463d6852c312

legend.m: Use correct value of "property"/value pair if specified multiple times. * legend.m: When extracting "location" and "orientation" properties from inputs, use the last occurrence to set the value for the property.
author Rik <rik@octave.org>
date Mon, 30 Sep 2019 11:02:09 -0700
parents 15752c577f6d
children b9c3717d68c5
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Mon Sep 30 12:11:06 2019 -0400
+++ b/scripts/plot/appearance/legend.m	Mon Sep 30 11:02:09 2019 -0700
@@ -204,16 +204,23 @@
   propvals = {};
 
   ## Find "location" and "orientation" property/value pairs
+  foundpos = foundorient = false;
   i = nargs - 1;
   while (i > 0)
     pos = varargin{i};
     str = varargin{i+1};
     if (strcmpi (pos, "location") && ischar (str))
-      location = lower (str);
+      if (! foundpos)
+        location = lower (str);
+        foundpos = true;
+      endif
       varargin(i:i+1) = [];
       nargs -= 2;
     elseif (strcmpi (pos, "orientation") && ischar (str))
-      orientation = lower (str);
+      if (! foundorient)
+        orientation = lower (str);
+        foundorient = true;
+      endif
       varargin(i:i+1) = [];
       nargs -= 2;
     endif