changeset 7337:e70789e0cd92

[project @ 2007-12-28 21:04:44 by jwe]
author jwe
date Fri, 28 Dec 2007 21:06:43 +0000
parents 745a8299c2b5
children 5215422865e0
files scripts/ChangeLog scripts/plot/Makefile.in scripts/plot/__ezplot__.m scripts/plot/ezcontour.m scripts/plot/ezcontourf.m scripts/plot/ezmesh.m scripts/plot/ezmeshc.m scripts/plot/ezplot3.m scripts/plot/ezpolar.m scripts/plot/ezsurf.m scripts/plot/ezsurfc.m scripts/plot/pcolor.m
diffstat 12 files changed, 914 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Dec 28 20:56:58 2007 +0000
+++ b/scripts/ChangeLog	Fri Dec 28 21:06:43 2007 +0000
@@ -1,3 +1,14 @@
+2007-12-28  David Bateman  <dbateman@free.fr>
+
+	* ezcontourf.m, ezcontour.m, ezmeshc.m, ezmesh.m, ezplot3.m,
+	__ezplot__.m, ezpolar.m, ezsurfc.m, ezsurf.m: New functions.
+	* Makefile.in (SOURCES): Add to the sources.
+
+2007-12-28  Kai Habel  <kai.habel@gmx.de>
+
+	* plot/pcolor.m: Swap 1st and 2nd argument in call to meshgrid.
+	Remove unnecessary call of size function.
+
 2007-12-21  John W. Eaton  <jwe@octave.org>
 
 	Version 3.0.0 released.
--- a/scripts/plot/Makefile.in	Fri Dec 28 20:56:58 2007 +0000
+++ b/scripts/plot/Makefile.in	Fri Dec 28 21:06:43 2007 +0000
@@ -43,6 +43,7 @@
   __default_plot_options__.m \
   __errcomm__.m \
   __errplot__.m \
+  __ezplot__.m \
   __go_close_all__.m \
   __go_draw_axes__.m \
   __go_draw_figure__.m \
@@ -87,6 +88,14 @@
   drawnow.m \
   ellipsoid.m \
   errorbar.m \
+  ezcontourf.m \
+  ezcontour.m \
+  ezmeshc.m \
+  ezmesh.m \
+  ezplot3.m \\
+  ezpolar.m \
+  ezsurfc.m \
+  ezsurf.m \
   feather.m \
   figure.m \
   fill.m \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/__ezplot__.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,299 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## Undocumented internal function
+
+function [h, needusage] = __ezplot__ (pfunc, varargin)
+
+  func = strcat ("ez", pfunc);
+  if (strncmp (pfunc, "contour", 7))
+    iscontour = true;
+  else
+    iscontour = false;
+  endif
+  if (strcmp (pfunc, "plot3"))
+    isplot3 = true;
+    ispolar = false;
+    nargs = 1
+  elseif (strcmp (pfunc, "polar"))
+    isplot3 = false;
+    ispolar = true;
+    nargs = 1;
+  else
+    isplot3 = false;
+    ispolar = false;
+    nargs = 2;
+  endif
+
+  [ax, varargin, nargin] = __plt_get_axis_arg__ (func, varargin{:});
+
+  needusage = false;
+  if (nargin < 1)
+    needusage = true;
+    return;
+  endif
+
+  parametric = false;
+  fun = varargin {1};
+  if (ischar (fun))
+    fun = vectorize (inline (fun));
+    if (length (argnames (fun)) != nargs)
+      error ("%s: excepting a function of %d arguments", func, nargs);
+    endif
+    fstr = formula (fun);
+    if (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = argnames(fun){1};
+      yarg = argnames(fun){2};
+    endif
+  elseif (strcmp (typeinfo (fun), "inline function"))
+    if (length (argnames (fun)) != nargs)
+      error ("%s: excepting a function of %d arguments", func, nargs);
+    endif
+    fun = vectorize (fun);
+    fstr = formula (fun);
+    if (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = argnames(fun)(1);
+      yarg = argnames(fun)(2);
+    endif
+  elseif (isa (fun, "function_handle"))
+    fstr = func2str (fun);
+    args = regexp (substr (fstr, 3, findstr (fstr, ")")(1) - 3), 
+		   '(\w[\w\d]*)', 'tokens');
+    if (length (args) != nargs)
+      error ("%s: excepting a function of %d arguments", func, nargs);
+    endif
+    fstr = substr (fstr, findstr (fstr, ")")(1) + 1);
+    if (isplot3)
+      xarg = "x";
+      yarg = "y";
+    elseif (ispolar)
+      xarg = "";
+      yarg = "";
+    else
+      xarg = args{1}{1};
+      yarg = args{2}{1};
+    endif
+  else
+    error ("%s: expecting string, inline function or function handle", func);
+  endif
+
+  if (nargin > 2)
+    funx = fun;
+    fstrx = fstr;
+    funy = varargin {2};
+    if (ischar (funy) && ! strcmp (funy, "circ") && ! strcmp (funy, "animate"))
+      parametric = true;
+      funy = vectorize (inline (funy));
+      if (length (argnames (funy)) != nargs)
+	error ("%s: excepting a function of %d arguments", func, nargs);
+      endif
+      fstry = formula (funy);
+    elseif (strcmp (typeinfo (funy), "inline function"))
+      parametric = true;
+      if (length (argnames (funy)) != nargs)
+	error ("%s: excepting a function of %d arguments", func, nargs);
+      endif
+      funy = vectorize (funy);
+      fstry = formula (funy);
+    elseif (isa (funy, "function_handle"))
+      parametric = true;
+      fstry = func2str (funy);
+      args = regexp (substr (fstry, 3, findstr (fstry, ")")(1) - 3), 
+		     '(\w[\w\d]*)', 'tokens');
+      if (length (args) != nargs)
+	error ("%s: excepting a function of %d arguments", func, nargs);
+      endif
+      fstry = substr (fstry, findstr (fstry, ")")(1) + 1);
+    endif
+
+    if (parametric)
+      funz = varargin {3};
+      if (ischar (funz) && ! strcmp (funz, "circ") && 
+	  ! strcmp (funy, "animate"))
+	funz = vectorize (inline (funz));
+	if (length (argnames (funz)) != nargs)
+	  error ("%s: excepting a function of %d arguments", func, nargs);
+	endif
+	fstrz = formula (funz);
+      elseif (strcmp (typeinfo (funz), "inline function"))
+	if (length (argnames (funz)) != nargs)
+	  error ("%s: excepting a function of %d arguments", func, nargs);
+	endif
+	funz = vectorize (funz);
+	fstrz = formula (funz);
+      elseif (isa (funz, "function_handle"))
+	fstrz = func2str (funz);
+	args = regexp (substr (fstrz, 3, findstr (fstrz, ")")(1) - 3), 
+		       '(\w[\w\d]*)', 'tokens');
+	if (length (args) != nargs)
+	  error ("%s: excepting a function of %d arguments", func, nargs);
+	endif
+	fstrz = substr (fstrz, findstr (fstrz, ")")(1) + 1);
+      else
+	error ("%s: parametric plots expect 3 functions", func);
+      endif
+    endif
+  endif
+
+  n = 60;
+  domain = [];
+  circ = false;
+  animate = false;
+  if (parametric)
+    iarg = 4;
+  else
+    iarg = 2;
+  endif
+  while (iarg <= nargin)
+    arg = varargin{iarg++};
+    if (ischar (arg) && strcmp (arg, "circ"))
+      circ = true;
+    elseif (ischar (arg) && strcmp (arg, "animate"))
+      animate = true;
+    elseif (isscalar (arg))
+      n = arg;
+    elseif (numel (arg) == 2)
+      domain = [arg(:).' arg(:).'];
+    elseif (numel (arg) == 4)
+      domain = arg(:).';
+    else
+      error ("%s: expecting scalar, 2 or 4 element vector", func);
+    endif
+  endwhile
+
+  if (isempty (domain))
+    if (isplot3 || ispolar)
+      domain = [0, 2*pi, 0, 2*pi];
+    else
+      domain = [-2*pi, 2*pi, -2*pi, 2*pi];
+    endif
+  endif
+
+  if (circ)
+    if (iscontour || isplot3)
+      needusage = true;
+      return;
+    endif
+    if (parametric)
+      error ("%s: can not have both circular domain and parametric function", 
+	     func);
+    endif
+    cent = [domain(1) + domain(2), domain(3) + domain(4)] / 2;
+    funx = @(r,t) r .* cos (t) + cent (1);
+    funy = @(r,t) r .* sin (t) + cent (2);
+    domain = [0, sqrt((domain(2) - cent(1))^2 + (domain(4) - cent(2))^2), ...
+	      -pi, pi];
+    funz = fun;
+    parametric = true;
+  endif
+
+  if (animate)
+    if (!isplot3)
+      error ("%s: animated graphs only valid with plot3", func);
+    endif
+    error ("%s: animated graphs not implemented", func);
+  endif
+
+  if (isplot3 || ispolar)
+    X = linspace (domain (1), domain (2), n);
+  else
+    x = linspace (domain (1), domain (2), n);
+    y = linspace (domain (3), domain (4), n);
+    [X, Y] = meshgrid (x, y);
+  endif
+  if (parametric)
+    if (isplot3)
+      Z = feval (funz, X);
+      XX = feval (funx, X);
+      YY = feval (funy, X);
+      X = XX;
+      Y = YY;
+    else
+      Z = feval (funz, X, Y);
+      XX = feval (funx, X, Y);
+      YY = feval (funy, X, Y);
+      X = XX;
+      Y = YY;
+
+      ## Eliminate the singularities
+      X = __eliminate_sing__ (X);
+      Y = __eliminate_sing__ (Y);
+      Z = __eliminate_sing__ (Z);
+    endif
+
+    fstrx = regexprep (regexprep (regexprep (fstrx,'\.\^\s*','^'), 
+		      '\./', '/'), '[\.]*\*', '');
+    fstry = regexprep (regexprep (regexprep (fstry,'\.\^\s*','^'), 
+		      '\./', '/'), '[\.]*\*', '');
+    fstrz = regexprep (regexprep (regexprep (fstrz,'\.\^\s*','^'), 
+		      '\./', '/'), '[\.]*\*', '');
+    fstr = strcat ("[",fstrx,",",fstry,",",fstrz,"]");
+  else
+    if (isplot3)
+      needusage = true;
+      return;
+    endif
+
+    if (ispolar)
+      Z = feval (fun, X);
+    else
+      Z = feval (fun, X, Y);
+
+      ## Eliminate the singularities
+      Z = __eliminate_sing__ (Z);
+    endif
+
+    fstr = regexprep (regexprep (regexprep (fstr,'\.\^\s*','^'), '\./', '/'), 
+		      '[\.]*\*', '');
+  endif
+
+  oldax = gca (); 
+  unwind_protect
+    axes (ax);
+    if (iscontour)
+      [clev, h] = feval (pfunc, X, Y, Z);
+    elseif (ispolar)
+      h = feval (pfunc, X, Z);
+    else
+      h = feval (pfunc, X, Y, Z);
+    endif
+    xlabel (xarg);
+    ylabel (yarg);
+    title (fstr);
+  unwind_protect_cleanup
+    axes (oldax);
+  end_unwind_protect
+
+endfunction
+
+function x = __eliminate_sing__ (x)
+  x (isinf (x)) = NaN;
+  x (abs (del2 (x)) > 0.2 * (max(x(:)) - min(x(:)))) = NaN;
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/ezcontour.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,66 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ezcontour (@var{f})
+## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezcontour (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezcontour (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezcontour (@dots{})
+##
+## Plots the contour lines of a function. @var{f} is a string, inline function
+## or function handle with two arguments defining the function. By default the
+## plot is over the domain @code{-2*pi < @var{x} < 2*pi} and @code{-2*pi < 
+## @var{y} < 2*pi} with 60 points in each dimension. 
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## value of both @var{x} and @var{y}. If @var{dom} is a four element vector,
+## then the minimum and maximum value of @var{x} and @var{y} are specify
+## separately.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## The optional return value @var{h} provides a list of handles to the 
+## the parts of the vector field (body, arrow and marker).
+##
+## @example
+## @group
+## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+## ezcontour (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{ezplot, ezcontourf, ezsurfc, ezmeshc}
+## @end deftypefn
+
+function retval = ezcontour (varargin)
+
+  [h, needusage] = __ezplot__ ("contour", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    retval = h;
+  endif
+endfunction
+
+%!demo
+%! f = @(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezcontour (f, [-3, 3]);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/ezcontourf.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,66 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ezcontourf (@var{f})
+## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezcontourf (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezcontourf (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezcontourf (@dots{})
+##
+## Plots the filled contour lines of a function. @var{f} is a string, inline 
+## function or function handle with two arguments defining the function. By 
+## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and 
+## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. 
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## value of both @var{x} and @var{y}. If @var{dom} is a four element vector,
+## then the minimum and maximum value of @var{x} and @var{y} are specify
+## separately.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## The optional return value @var{h} provides a list of handles to the 
+## the parts of the vector field (body, arrow and marker).
+##
+## @example
+## @group
+## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+## ezcontourf (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{ezplot, ezcontour, ezsurfc, ezmeshc}
+## @end deftypefn
+
+function retval = ezcontourf (varargin)
+
+  [h, needusage] = __ezplot__ ("contourf", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    retval = h;
+  endif
+endfunction
+
+%!demo
+%! f = @(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezcontourf (f, [-3, 3]);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/ezmesh.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,92 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ezmesh (@var{f})
+## @deftypefnx {Function File} {} ezmesh (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezmesh (@dots{}, 'circ')
+## @deftypefnx {Function File} {} ezmesh (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezmesh (@dots{})
+##
+## Plots the mesh defined by a function. @var{f} is a string, inline
+## function or function handle with two arguments defining the function. By 
+## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and
+## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. 
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## value of both @var{x} and @var{y}. If @var{dom} is a four element vector,
+## then the minimum and maximum value of @var{x} and @var{y} are specify
+## separately.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined 
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), 
+## @var{fz} (@var{s}, @var{t})]}. 
+##
+## If the argument 'circ' is given, then the function is plotted over a disk
+## centered on the middle of the domain @var{dom}.
+##
+## The optional return value @var{h} provides a list of handles to the 
+## the parts of the vector field (body, arrow and marker).
+##
+## @example
+## @group
+## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+## ezmesh (f, [-3, 3]);
+## @end group
+## @end example
+##
+## An example of a parametrically defined function is
+##
+## @example
+## @group
+## fx = @@(s,t) cos (s) .* cos(t);
+## fy = @@(s,t) sin (s) .* cos(t);
+## fz = @@(s,t) sin(t);
+## ezmesh (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
+## @end group
+## @end example
+##
+## @seealso{ezplot, ezsurf, ezsurfc, ezmeshc}
+## @end deftypefn
+
+function retval = ezmesh (varargin)
+
+  [h, needusage] = __ezplot__ ("mesh", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    retval = h;
+  endif
+endfunction
+
+%!demo
+%! f = @(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezmesh (f, [-3, 3]);
+
+%!demo
+%! fx = @(s,t) cos (s) .* cos(t);
+%! fy = @(s,t) sin (s) .* cos(t);
+%! fz = @(s,t) sin (t);
+%! ezmesh (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/ezmeshc.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,75 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ezmeshc (@var{f})
+## @deftypefnx {Function File} {} ezmeshc (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezmeshc (@dots{}, 'circ')
+## @deftypefnx {Function File} {} ezmeshc (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezmeshc (@dots{})
+##
+## Plots the mesh and contour lines defined by a function. @var{f} is a string,
+## inline function or function handle with two arguments defining the function.
+## By default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and
+## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. 
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## value of both @var{x} and @var{y}. If @var{dom} is a four element vector,
+## then the minimum and maximum value of @var{x} and @var{y} are specify
+## separately.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined 
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), 
+## @var{fz} (@var{s}, @var{t})]}. 
+##
+## If the argument 'circ' is given, then the function is plotted over a disk
+## centered on the middle of the domain @var{dom}.
+##
+## The optional return value @var{h} provides a list of handles to the 
+## the parts of the vector field (body, arrow and marker).
+##
+## @example
+## @group
+## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+## ezmeshc (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{ezplot, ezsurfc, ezsurf, ezmesh}
+## @end deftypefn
+
+function retval = ezmeshc (varargin)
+
+  [h, needusage] = __ezplot__ ("meshc", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    retval = h;
+  endif
+endfunction
+
+%!demo
+%! f = @(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezmeshc (f, [-3, 3]);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/ezplot3.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,67 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ezplot3 (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezplot3 (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezplot3 (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezplot3 (@dots{})
+##
+## Plots in three-dimensions the curve defined parametrically. 
+## @var{fx}, @var{fy}, and @var{fz} are strings, inline functions
+## or function handles with one arguments defining the function. By 
+## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi}  
+## with 60 points. 
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## value of @var{t}. @var{n} is a scalar defining the number of points to use.
+##
+## The optional return value @var{h} provides a list of handles to the 
+## the parts of the vector field (body, arrow and marker).
+##
+## @example
+## @group
+## fx = @@(t) cos (t);
+## fy = @@(t) sin (t);
+## fz = @@(t) t;
+## ezplot3 (fx, fy, fz, [0, 10*pi], 100);
+## @end group
+## @end example
+##
+## @seealso{plot3, ezplot, ezsurf, ezmesh}
+## @end deftypefn
+
+function retval = ezplot3 (varargin)
+
+  [h, needusage] = __ezplot__ ("plot3", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    retval = h;
+  endif
+endfunction
+
+%!demo
+%! fx = @(t) cos (t);
+%! fy = @(t) sin (t);
+%! fz = @(t) t;
+%! ezplot3 (fx, fy, fz, [0, 10*pi], 100);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/ezpolar.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,59 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ezpolar (@var{f})
+## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezpolar (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezpolar (@dots{})
+##
+## Plots in polar plot defined by a function. The function @var{f} is either
+## a string, inline function or function handle with one arguments defining 
+## the function. By default the plot is over the domain @code{0 < @var{x} < 
+## 2*pi} with 60 points. 
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## value of both @var{t}. @var{n} is a scalar defining the number of points to 
+## use.
+##
+## The optional return value @var{h} provides a list of handles to the 
+## the parts of the vector field (body, arrow and marker).
+##
+## @example
+## ezpolar (@@(t) 1 + sin (t));
+## @end example
+##
+## @seealso{polar, ezplot, ezsurf, ezmesh}
+## @end deftypefn
+
+function retval = ezpolar (varargin)
+
+  [h, needusage] = __ezplot__ ("polar", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    retval = h;
+  endif
+endfunction
+
+%!demo
+%! ezpolar (@(t) 1 + sin (t));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/ezsurf.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,92 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ezsurf (@var{f})
+## @deftypefnx {Function File} {} ezsurf (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezsurf (@dots{}, 'circ')
+## @deftypefnx {Function File} {} ezsurf (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezsurf (@dots{})
+##
+## Plots the surface defined by a function. @var{f} is a string, inline
+## function or function handle with two arguments defining the function. By 
+## default the plot is over the domain @code{-2*pi < @var{x} < 2*pi} and
+## @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. 
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## value of both @var{x} and @var{y}. If @var{dom} is a four element vector,
+## then the minimum and maximum value of @var{x} and @var{y} are specify
+## separately.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined 
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), 
+## @var{fz} (@var{s}, @var{t})]}. 
+##
+## If the argument 'circ' is given, then the function is plotted over a disk
+## centered on the middle of the domain @var{dom}.
+##
+## The optional return value @var{h} provides a list of handles to the 
+## the parts of the vector field (body, arrow and marker).
+##
+## @example
+## @group
+## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+## ezsurf (f, [-3, 3]);
+## @end group
+## @end example
+##
+## An example of a parametrically defined function is
+##
+## @example
+## @group
+## fx = @@(s,t) cos (s) .* cos(t);
+## fy = @@(s,t) sin (s) .* cos(t);
+## fz = @@(s,t) sin(t);
+## ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2], 20);
+## @end group
+## @end example
+##
+## @seealso{ezplot, ezmesh, ezsurfc, ezmeshc}
+## @end deftypefn
+
+function retval = ezsurf (varargin)
+
+  [h, needusage] = __ezplot__ ("surf", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    retval = h;
+  endif
+endfunction
+
+%!demo
+%! f = @(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezsurf (f, [-3, 3]);
+
+%!demo
+%! fx = @(s,t) cos (s) .* cos(t);
+%! fy = @(s,t) sin (s) .* cos(t);
+%! fz = @(s,t) sin (t);
+%! ezsurf (fx, fy, fz, [-pi,pi,-pi/2,pi/2], 20);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/ezsurfc.m	Fri Dec 28 21:06:43 2007 +0000
@@ -0,0 +1,75 @@
+## Copyright (C) 2007 David Bateman
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ezsurfc (@var{f})
+## @deftypefnx {Function File} {} ezsurfc (@var{fx}, @var{fy}, @var{fz})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{dom})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, @var{n})
+## @deftypefnx {Function File} {} ezsurfc (@dots{}, 'circ')
+## @deftypefnx {Function File} {} ezsurfc (@var{h}, @dots{})
+## @deftypefnx {Function File} {@var{h} =} ezsurfc (@dots{})
+##
+## Plots the surface and contour lines defined by a function. @var{f} is a
+## string, inline function or function handle with two arguments defining the
+## function. By default the plot is over the domain @code{-2*pi < @var{x} <
+## 2*pi} and @code{-2*pi < @var{y} < 2*pi} with 60 points in each dimension. 
+##
+## If @var{dom} is a two element vector, it represents the minimum and maximum
+## value of both @var{x} and @var{y}. If @var{dom} is a four element vector,
+## then the minimum and maximum value of @var{x} and @var{y} are specify
+## separately.
+##
+## @var{n} is a scalar defining the number of points to use in each dimension.
+##
+## If three functions are passed, then plot the parametrically defined 
+## function @code{[@var{fx} (@var{s}, @var{t}), @var{fy} (@var{s}, @var{t}), 
+## @var{fz} (@var{s}, @var{t})]}. 
+##
+## If the argument 'circ' is given, then the function is plotted over a disk
+## centered on the middle of the domain @var{dom}.
+##
+## The optional return value @var{h} provides a list of handles to the 
+## the parts of the vector field (body, arrow and marker).
+##
+## @example
+## @group
+## f = @@(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+## ezsurfc (f, [-3, 3]);
+## @end group
+## @end example
+##
+## @seealso{ezplot, ezmeshc, ezsurf, ezmesh}
+## @end deftypefn
+
+function retval = ezsurfc (varargin)
+
+  [h, needusage] = __ezplot__ ("surfc", varargin{:});
+
+  if (needusage)
+    print_usage ();
+  endif
+
+  if (nargout > 0)
+    retval = h;
+  endif
+endfunction
+
+%!demo
+%! f = @(x,y) sqrt(abs(x .* y)) ./ (1 + x.^2 + y.^2);
+%! ezsurfc (f, [-3, 3]);
--- a/scripts/plot/pcolor.m	Fri Dec 28 20:56:58 2007 +0000
+++ b/scripts/plot/pcolor.m	Fri Dec 28 21:06:43 2007 +0000
@@ -36,9 +36,9 @@
 
   if (nargin == 1)
     c = x;
-    z = zeros (size (c));
-    [nr, nc] = size (c);
-    [x, y] = meshgrid (1:nr, 1:nc);
+    [nr, nc] = size(c);
+    z = zeros (nr, nc);
+    [x, y] = meshgrid (1:nc, 1:nr);
   elseif (nargin == 3)
     z = zeros (size (c));
   else