comparison scripts/plot/ezpolar.m @ 16993:78f57b14535c

Overhaul ez* family of plot functions. * scripts/plot/ezcontour.m, scripts/plot/ezcontourf.m, scripts/plot/ezmesh.m, scripts/plot/ezmeshc.m, scripts/plot/ezpolar.m, scripts/plot/ezsurfc.m: Redo docstring. Match function output names to docstring. * scripts/plot/ezplot.m: Add %!demo block with sinc function. Redo docstring. Match function output names to docstring. scripts/plot/ezplot3.m: Add %!demo block showing 'animate' option. Redo docstring. Match function output names to docstring. * scripts/plot/ezsurf.m: Add %!demo block showing 'circ' argument. Redo docstring. Match function output names to docstring. * scripts/plot/private/__ezplot__.m: Implement 'circ' option for ezsurf, ezmesh. Implement 'animate' option for ezplot3. Implement new algorithm for finding valid axis setting for mesh, surf, contour plots based on function gradient. Eliminate complex Z values along with singularities because these are not plottable by mesh, surf. Implement Matlab-compatible 2-pass approach to finding valid domain for plot. Use 500 points for point-style plot functions ezplot, ezplot3, ezpolar rather than previous 60 for a smoother plot. Use better regexprep() calls to format "pretty print" title string. Relax input checking and allow 3rd parametric function to be a function of 1 variable only. Clean up code and use Octave coding conventions.
author Rik <rik@octave.org>
date Wed, 17 Jul 2013 10:09:44 -0700
parents 9bb633cbdb96
children eaab03308c0b
comparison
equal deleted inserted replaced
16992:4e8f49304059 16993:78f57b14535c
21 ## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{dom}) 21 ## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{dom})
22 ## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{n}) 22 ## @deftypefnx {Function File} {} ezpolar (@dots{}, @var{n})
23 ## @deftypefnx {Function File} {} ezpolar (@var{hax}, @dots{}) 23 ## @deftypefnx {Function File} {} ezpolar (@var{hax}, @dots{})
24 ## @deftypefnx {Function File} {@var{h} =} ezpolar (@dots{}) 24 ## @deftypefnx {Function File} {@var{h} =} ezpolar (@dots{})
25 ## 25 ##
26 ## Plot a function in polar coordinates. The function @var{f} is 26 ## Plot a 2-D function in polar coordinates.
27 ## a string, inline function, or function handle with a single argument. 27 ##
28 ## The expected form of the function is 28 ## The function @var{f} is a string, inline function, or function handle with
29 ## a single argument. The expected form of the function is
29 ## @code{@var{rho} = @var{f}(@var{theta})}. 30 ## @code{@var{rho} = @var{f}(@var{theta})}.
30 ## By default the plot is over the domain @code{0 < @var{theta} < 2*pi} with 60 31 ## By default the plot is over the domain @code{0 <= @var{theta} <= 2*pi}
31 ## points. 32 ## with 500 points.
32 ## 33 ##
33 ## If @var{dom} is a two element vector, it represents the minimum and maximum 34 ## If @var{dom} is a two element vector, it represents the minimum and maximum
34 ## values of @var{theta}. @var{n} is a scalar defining the number of points to 35 ## values of @var{theta}.
35 ## use. If the optional input @var{hax} is given then the plot is placed into 36 ##
36 ## the specified axes rather than the current axes. 37 ## @var{n} is a scalar defining the number of points to use in plotting
38 ## the function.
39 ##
40 ## If the first argument is an axis handle, @var{hax}, then plot into this
41 ## axis rather than the current axis handle returned by @code{gca}.
37 ## 42 ##
38 ## The optional return value @var{h} is a graphics handle to the created plot. 43 ## The optional return value @var{h} is a graphics handle to the created plot.
39 ## 44 ##
40 ## Example: 45 ## Example:
41 ## 46 ##
42 ## @example 47 ## @example
43 ## ezpolar (@@(t) 1 + sin (t)); 48 ## ezpolar (@@(t) 1 + sin (t));
44 ## @end example 49 ## @end example
45 ## 50 ##
46 ## @seealso{polar, ezplot, ezsurf, ezmesh} 51 ## @seealso{polar, ezplot}
47 ## @end deftypefn 52 ## @end deftypefn
48 53
49 function retval = ezpolar (varargin) 54 function h = ezpolar (varargin)
50 55
51 [h, needusage] = __ezplot__ ("polar", varargin{:}); 56 [htmp, needusage] = __ezplot__ ("polar", varargin{:});
52 57
53 if (needusage) 58 if (needusage)
54 print_usage (); 59 print_usage ();
55 endif 60 endif
56 61
57 if (nargout > 0) 62 if (nargout > 0)
58 retval = h; 63 h = htmp;
59 endif 64 endif
60 65
61 endfunction 66 endfunction
62 67
63 68