changeset 17566:4166048ba6cf

text.m: Fix text location if "Position" specified as prop/value pair. * scripts/plot/text.m: Search for "position" property in input PROP/VAL pairs and use coordinates if available.
author Rik <rik@octave.org>
date Fri, 04 Oct 2013 10:00:44 -0700
parents ddecb2e231d4
children 0b3cf264ec2f
files scripts/plot/text.m
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/text.m	Fri Oct 04 08:05:00 2013 -0700
+++ b/scripts/plot/text.m	Fri Oct 04 10:00:44 2013 -0700
@@ -131,11 +131,20 @@
     hax = gca ();
   endif
 
+  ## Position argument may alse be in PROP/VAL pair
+  idx = find (strcmpi (varargin, "position"), 1);
+  if (idx)
+    pos = varargin{idx+1};
+    varargin(idx:idx+1) = [];
+  else
+    pos = [x(:), y(:), z(:)];
+  endif
+
   if (nx == ny && nx == nz && (nt == nx || nt == 1 || nx == 1))
-    pos = [x(:), y(:), z(:)];
     htmp = zeros (nt, 1);
     if (nx == 1)
       htmp = __go_text__ (hax, "string", string{1},
+                               ## varargin first, in case "Units" set for pos.
                                varargin{:},
                                "position", pos);
     elseif (nx == nt)