changeset 17515:79535e3d53e0

Merge the official development
author LYH <lyh.kernel@gmail.com>
date Thu, 26 Sep 2013 19:15:27 +0800
parents 8376ff1462b8 (current diff) 96cf8ee3440e (diff)
children 432a110f6064
files
diffstat 6 files changed, 51 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/graphics_toolkit.m
+++ b/scripts/plot/graphics_toolkit.m
@@ -21,8 +21,7 @@
 ## @deftypefnx {Function File} {@var{name} =} graphics_toolkit (@var{hlist})
 ## @deftypefnx {Function File} {} graphics_toolkit (@var{name})
 ## @deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name})
-## Query or set the default graphics toolkit which is assigned to new
-## figures.
+## Query or set the default graphics toolkit which is assigned to new figures.
 ## 
 ## With no inputs, return the current default graphics toolkit.  If the input
 ## is a list of figure graphic handles, @var{hlist}, then return the name
--- a/scripts/plot/hidden.m
+++ b/scripts/plot/hidden.m
@@ -52,7 +52,8 @@
 
   for h = (get (gca (), "children")).';
     htype = get (h, "type");
-    if (strcmp (htype, "surface"))
+    htag = get (h, "tag");
+    if (strcmp (htype, "surface") || strcmp (htag, "trimesh"))
       fc = get (h, "facecolor");
       if ((! ischar (fc) && is_white (fc))
           || (ischar (fc) && strcmp (fc, "none")))
--- a/scripts/plot/meshgrid.m
+++ b/scripts/plot/meshgrid.m
@@ -36,19 +36,24 @@
 ## plot of the ``sombrero'' function.
 ##
 ## @example
+## @group
 ## f = @@(x,y) sin (sqrt (x.^2 + y.^2)) ./ sqrt (x.^2 + y.^2);
 ## range = linspace (-8, 8, 41);
 ## [@var{X}, @var{Y}] = meshgrid (range, range);  
 ## Z = f (X, Y);
 ## surf (X, Y, Z);
+## @end group
 ## @end example
 ##
 ## Programming Note: @code{meshgrid} is restricted to 2-D or 3-D grid
 ## generation.  The @code{ndgrid} function will generate 1-D through N-D
 ## grids.  However, the functions are not completely equivalent.  If @var{x}
 ## is a vector of length M and @var{y} is a vector of length N, then
-## @code{meshgrid} will produce an output grid which is NxM.  @code{ndgrid}
-## will produce an output which is MxN for the same input.
+## @code{meshgrid} will produce an output grid which is NxM@.  @code{ndgrid}
+## will produce an output which is MxN (transpose) for the same input.  Some
+## core functions expect @code{meshgrid} input and others expect @code{ndgrid}
+## input.  Check the documentation for the function in question to determine
+## the proper input format.
 ## @seealso{ndgrid, mesh, contour, surf}
 ## @end deftypefn
 
--- a/scripts/plot/ndgrid.m
+++ b/scripts/plot/ndgrid.m
@@ -19,14 +19,20 @@
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x1}, @var{x2}, @dots{}, @var{x}n)
 ## @deftypefnx {Function File} {[@var{y1}, @var{y2}, @dots{}, @var{y}n] =} ndgrid (@var{x})
-## Given n vectors @var{x1}, @dots{} @var{x}n, @code{ndgrid} returns
+## Given n vectors @var{x1}, @dots{}, @var{x}n, @code{ndgrid} returns
 ## n arrays of dimension n.  The elements of the i-th output argument
 ## contains the elements of the vector @var{x}i repeated over all
 ## dimensions different from the i-th dimension.  Calling ndgrid with
-## only one input argument @var{x} is equivalent of calling ndgrid with
+## only one input argument @var{x} is equivalent to calling ndgrid with
 ## all n input arguments equal to @var{x}:
 ##
 ## [@var{y1}, @var{y2}, @dots{}, @var{y}n] = ndgrid (@var{x}, @dots{}, @var{x})
+##
+## Programming Note: @code{ndgrid} is very similar to the function
+## @code{meshgrid} except that the first two dimensions are transposed in
+## comparison to @code{meshgrid}.  Some core functions expect @code{meshgrid}
+## input and others expect @code{ndgrid} input.  Check the documentation for
+## the function in question to determine the proper input format.
 ## @seealso{meshgrid}
 ## @end deftypefn
 
--- a/scripts/plot/text.m
+++ b/scripts/plot/text.m
@@ -21,14 +21,18 @@
 ## @deftypefnx {Function File} {} text (@var{x}, @var{y}, @var{z}, @var{string})
 ## @deftypefnx {Function File} {} text (@dots{}, @var{prop}, @var{val}, @dots{})
 ## @deftypefnx {Function File} {@var{h} =} text (@dots{})
-## Create a text object with text @var{string} at position @var{x},
-## @var{y}, @var{z} on the current axes.
+## Create a text object with text @var{string} at position @var{x}, @var{y},
+## (@var{z}) on the current axes.
 ##
-## Optional property/value pairs following may be used to specify the
-## appearance of the text.
+## Multiple locations can be specified if @var{x}, @var{y}, (@var{z}) are
+## vectors.  Multiple strings can be specified with a character matrix or
+## a cell array of strings.
 ##
-## The optional return value @var{h} is a graphics handle to the created text
-## object.
+## Optional property/value pairs may be used to control the appearance of the
+## text.
+##
+## The optional return value @var{h} is a vector of graphics handles to the
+## created text objects.
 ## @seealso{gtext, title, xlabel, ylabel, zlabel}
 ## @end deftypefn
 
@@ -54,64 +58,64 @@
       offset = 3;
     endif
 
-    label = varargin{offset};
+    string = varargin{offset};
     varargin(1:offset) = [];
 
     nx = numel (x);
     ny = numel (y);
     nz = numel (z);
-    if (ischar (label))
+    if (ischar (string))
 
       do_keyword_repl = true;
-      nt = rows (label);
+      nt = rows (string);
       if (nx == 1 && nt == 1)
         ## Single text object with one line
-        label = {label};
+        string = {string};
       elseif (nx == 1 && nt > 1)
         ## Single text object with multiple lines
         ## FIXME: "default" or "factory" as first row
         ##        should be escaped to "\default" or "\factory"
         ##        Other rows do not require escaping.
         do_keyword_repl = false;
-        label = {label};
+        string = {string};
       elseif (nx > 1 && nt == nx)
         ## Mutiple text objects with different strings
-        label = cellstr (label);
+        string = cellstr (string);
       else 
         ## Mutiple text objects with same string
-        label = repmat ({label}, [nx, 1]);
+        string = repmat ({string}, [nx, 1]);
         nt = nx;
       endif
 
       ## Escape special keywords
       if (do_keyword_repl)
-        label = regexprep (label, '^(default|factory)$', '\\$1');
+        string = regexprep (string, '^(default|factory)$', '\\$1');
       endif
 
-    elseif (iscell (label))
+    elseif (iscell (string))
 
-      nt = numel (label);
+      nt = numel (string);
       if (nx == 1)      
         ## Single text object with one or more lines
-        label = {label};
+        string = {string};
         nt = 1;
       elseif (nx > 1 && nt == nx)
         ## Mutiple text objects with different strings
       else
         ## Mutiple text objects with same string
-        label = repmat ({label}, [nx, 1]);
+        string = repmat ({string}, [nx, 1]);
         nt = nx;
       endif
 
     else
 
-      error ("text: LABEL must be a character string or cell array of character strings");
+      error ("text: STRING must be a character string or cell array of character strings");
 
     endif
   else  # Only PROP/VALUE pairs
     x = y = z = 0;
     nx = ny = nz = 1;
-    label = {""};
+    string = {""};
     nt = 1;
   endif
 
@@ -131,18 +135,18 @@
     pos = [x(:), y(:), z(:)];
     htmp = zeros (nt, 1);
     if (nx == 1)
-      htmp = __go_text__ (hax, "string", label{1},
-                          varargin{:},
-                          "position", pos);
+      htmp = __go_text__ (hax, "string", string{1},
+                               varargin{:},
+                               "position", pos);
     elseif (nx == nt)
       for n = 1:nt
-        htmp(n) = __go_text__ (hax, "string", label{n},
-                               varargin{:},
-                               "position", pos(n,:));
+        htmp(n) = __go_text__ (hax, "string", string{n},
+                                    varargin{:},
+                                    "position", pos(n,:));
       endfor
       __request_drawnow__ ();
     else
-      error ("text: dimension mismatch for coordinates and LABEL");
+      error ("text: dimension mismatch for coordinates and STRING");
     endif
   elseif (nt == nx || nt == 1 || nx == 1)
     error ("text: dimension mismatch for coordinates");
--- a/scripts/plot/trimesh.m
+++ b/scripts/plot/trimesh.m
@@ -79,9 +79,10 @@
 
     hax = newplot ();
 
+    ## Tag object as "trimesh" so that hidden() can find it.
     htmp = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri,
                   "FaceVertexCdata", c, "EdgeColor", "flat", "FaceColor", "w",
-                  varargin{:});
+                  "Tag", "trimesh", varargin{:});
     if (! ishold ())
       set (hax, "view", [-37.5, 30], "box", "off",
                 "xgrid", "on", "ygrid", "on", "zgrid", "on");