octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Additional core 2D plotting functions


From: David Bateman
Subject: Additional core 2D plotting functions
Date: Mon, 17 Dec 2007 23:42:31 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Here is a patch that adds the feather, compass and rose functions. These
are matlab core 2D plotting functions. After this patch, the only
missing 2D core plotting functions are the ez*.m functions. I suppose
the ez*.m function might be written as well though haven't looked at them.

There are many more missing 3D functions that either need lighting
(surfl, etc), or filled patches (fill3, waterfall), and there are a
couple that might be written with the existing functionality like
contourslice. Maybe after 3.0

The patch also modifies the polar function, though John you might choose
to drop this part. My issue with polar is that the matlab version, draws
a circular patch object, and then adds circular and radial dashed lines
to it. Although no handle is returned to these you can see they exist with

h = polar(1:10)
get(gca(),'children')

I'm not sure its a great idea to do this, but we can make the polar
plots look a bit nicer with the attached patch to polar.m. It also added
the possibility to allow {x|y}axislocation to be "zero" and the axis is
printed on the zero axis (if possible), which is not matlab compatible
but seems like a fairly obvious thing to want to do. Note that as it
stands {x|y}axislocation are not radio values and can take on any value
the user wants. This should probably be fixed.

Regards
David
*** ./scripts/plot/rose.m.orig8 2007-12-17 22:04:00.062287351 +0100
--- ./scripts/plot/rose.m       2007-12-17 23:00:53.223519454 +0100
***************
*** 0 ****
--- 1,107 ----
+ ## 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} {} rose (@var{th}, @var{r})
+ ## @deftypefnx {Function File} {} rose (@var{h}, @dots{})
+ ## @deftypefnx {Function File} address@hidden =} compass (@dots{})
+ ## @deftypefnx {Function File} address@hidden, @var{th}] =} compass (@dots{})
+ ##
+ ## Plot an angular histogram. With one vector argument @var{th}, plots the
+ ## histogram with 20 angular bins. If @var{th} is a matrix, then each column
+ ## of @var{th} produces a separate histogram.
+ ##
+ ## If @var{r} is given and is a scalar, then the histogram is produced with
+ ## @var{r} bins. If @var{r} is a vector, then the center of each bin are 
+ ## defined by the values of @var{r}.
+ ##
+ ## The optional return value @var{h} provides a list of handles to the 
+ ## the parts of the vector field (body, arrow and marker).
+ ##
+ ## If two output arguments are requested, then rather than plotting the 
+ ## histogram, the polar vectors necessary to plot the histogram are 
+ ## returned.
+ #
+ ## @example
+ ## [r, t] = rose ([2*randn(1e5,1), pi + 2 * randn(1e5,1)]);
+ ## polar (r, t);
+ ## @end example
+ ##
+ ##
+ ## @seealso{plot, compass, polar, hist}
+ ## @end deftypefn
+ 
+ function [thout, rout] = rose (varargin)
+ 
+   [h, varargin, nargin] = __plt_get_axis_arg__ ((nargout > 1), "rose", 
+                                               varargin{:});
+ 
+   if (nargin < 1)
+     print_usage ();
+   endif
+ 
+   ## Force theta to [0,2*pi] range
+   th = varargin {1};
+   th = atan2  (sin (th), cos (th)) + pi;
+ 
+   if (nargin > 1)
+     x = varargin {2};
+     if (isscalar (x))
+       x = [0.5/x : 1/x : 1] * 2 * pi; 
+     else
+       ## Force theta to [0,2*pi] range
+       x = atan2  (sin (x), cos (x)) + pi;
+     endif
+   else
+     x = [1/40 : 1/20 : 1] * 2 * pi;
+   endif
+ 
+   [nn, xx] = hist (th, x);
+   xx = xx(:).';
+   if (isvector (nn))
+     nn = nn (:);
+   endif
+   x1 = xx(1:end-1) + diff (xx, 1) / 2;
+   x1 = [x1 ; x1; x1; x1](:);
+   th = [0; 0; x1; 2*pi ; 2*pi];
+   r = zeros (4 * size (nn, 1), size (nn, 2));
+   r(2:4:end, :) = nn;
+   r(3:4:end, :) = nn;
+ 
+   if (nargout < 2)
+     oldh = gca ();
+     unwind_protect
+       axes (h);
+       newplot ();
+       hlist = polar (h, th, r);
+     unwind_protect_cleanup
+       axes (oldh);
+     end_unwind_protect
+ 
+     if (nargout > 0)
+       thout = hlist;
+     endif
+   else
+     thout = th;
+     rout = r;
+   endif
+ 
+ endfunction
+ 
+ %!demo
+ %! rose ([2*randn(1e5,1), pi + 2 * randn(1e5,1)])
*** ./scripts/plot/polar.m.orig8        2007-12-17 22:03:24.675296298 +0100
--- ./scripts/plot/polar.m      2007-12-17 23:20:17.560419116 +0100
***************
*** 30,63 ****
  
  function retval = polar (varargin)
  
!   [h, varargin] = __plt_get_axis_arg__ ("polar", varargin{:});
  
    oldh = gca ();
    unwind_protect
      axes (h);
      newplot ();
  
-     nargs = numel (varargin);
- 
      if (nargs == 3)
        if (! ischar (varargin{3}))
        error ("polar: third argument must be a string");
        endif
        tmp = __plr2__ (h, varargin{:});
!     elseif (nargin == 2)
        if (ischar (varargin{2}))
        tmp = __plr1__ (h, varargin{:});
        else
        fmt = "";
        tmp = __plr2__ (h, varargin{:}, fmt);
        endif
!     elseif (nargin == 1)
        fmt = "";
        tmp = __plr1__ (h, varargin{:}, fmt);
      else
        print_usage ();
      endif
  
      if (nargout > 0)
        retval = tmp;
      endif
--- 30,77 ----
  
  function retval = polar (varargin)
  
!   [h, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:});
  
    oldh = gca ();
    unwind_protect
      axes (h);
      newplot ();
  
      if (nargs == 3)
        if (! ischar (varargin{3}))
        error ("polar: third argument must be a string");
        endif
        tmp = __plr2__ (h, varargin{:});
!       maxr = max (varargin {2} (:));
!     elseif (nargs == 2)
        if (ischar (varargin{2}))
        tmp = __plr1__ (h, varargin{:});
+       if (iscomplex(varargin{1}))
+         maxr = max (imag(varargin{1})(:));
+       else
+         maxr = max (varargin{1}(:));
+       endif
        else
        fmt = "";
        tmp = __plr2__ (h, varargin{:}, fmt);
+       maxr = max (varargin {2} (:));
        endif
!     elseif (nargs == 1)
        fmt = "";
        tmp = __plr1__ (h, varargin{:}, fmt);
+       if (iscomplex(varargin{1}))
+       maxr = max (imag(varargin{1})(:));
+       else
+       maxr = max (varargin{1}(:));
+       endif
      else
        print_usage ();
      endif
  
+     set (h, "xlim", [-maxr, maxr], "ylim", [-maxr, maxr],
+        "xaxislocation", "zero", "yaxislocation", "zero",
+        "dataaspectratio", [1, 1, 1]); 
+ 
      if (nargout > 0)
        retval = tmp;
      endif
*** ./scripts/plot/feather.m.orig8      2007-12-17 22:03:45.438117576 +0100
--- ./scripts/plot/feather.m    2007-12-16 23:12:29.089240637 +0100
***************
*** 0 ****
--- 1,117 ----
+ ## 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} {} feather (@var{u}, @var{v})
+ ## @deftypefnx {Function File} {} feather (@var{z})
+ ## @deftypefnx {Function File} {} feather (@dots{}, @var{style})
+ ## @deftypefnx {Function File} {} feather (@var{h}, @dots{})
+ ## @deftypefnx {Function File} address@hidden =} feather (@dots{})
+ ##
+ ## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
+ ## from equidistant points on the x-axis. If a single complex argument
+ ## @var{z} is given, then @address@hidden = real (@var{z})} and
+ ## @address@hidden = imag (@var{z})}.
+ ##
+ ## The style to use for the plot can be defined with a line style @var{style}
+ ## in a similar manner to the line styles used with the @code{plot} command.
+ ##
+ ## 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
+ ## phi = [0 : 15 : 360] * pi / 180;
+ ## feather (sin (phi), cos (phi))
+ ## @end group
+ ## @end example
+ ##
+ ## @seealso{plot, quiver, compass}
+ ## @end deftypefn
+ 
+ function retval = feather (varargin)
+ 
+   [h, varargin, nargin] = __plt_get_axis_arg__ ("feather", varargin{:});
+ 
+   arrowsize = 0.25;
+   firstnonnumeric = Inf;
+   for i = 1:nargin
+     if (! isnumeric (varargin{i}))
+       firstnonnumeric = i;
+       break;
+     endif
+   endfor
+ 
+   if (nargin < 2 || firstnonnumeric < 2)
+     ioff = 2;
+     z = varargin {1} (:) .';
+     u = real (z);
+     v = imag (z);
+   else
+     ioff = 3;
+     u = varargin {1} (:) .';
+     v = varargin {2} (:) .';
+   endif
+ 
+   line_spec = "b-";
+   while (ioff <= nargin)
+     arg = varargin{ioff++};
+     if ((isstr (arg) || iscell (arg)) && ! have_line_spec)
+       [linespec, valid] = __pltopt__ ("feather", arg, false);
+       if (valid)
+       line_spec = arg;
+       break;
+       else
+       error ("feather: invalid linespec");
+       endif
+     else
+       error ("feather: unrecognized argument");
+     endif
+   endwhile
+ 
+   ## Matlab draws feather plots, with the arrow head as one continous 
+   ## line, and each arrow separately. This is completely different than 
+   ## quiver and quite ugly.
+   n = length (u);
+   xend = [1 : n] + u;
+   xtmp = [1 : n] + u .* (1 - arrowsize);
+   yend = v;
+   ytmp = v .* (1 - arrowsize);
+   x = [[1 : n]; xend; xtmp  - v * arrowsize; xend; ...
+        xtmp + v * arrowsize];
+   y = [zeros(1, n); yend; ytmp  + u * arrowsize / 3; yend; ...
+        ytmp - u * arrowsize / 3];
+ 
+   oldh = gca ();
+   unwind_protect
+     axes (h);
+     newplot ();
+     hlist = plot (h, x, y, line_spec, [1, n], [0, 0], line_spec);
+   unwind_protect_cleanup
+     axes (oldh);
+   end_unwind_protect
+ 
+   if (nargout > 0)
+     retval = hlist;
+   endif
+ 
+ endfunction
+ 
+ %!demo
+ %! phi = [0 : 15 : 360] * pi / 180;
+ %! feather (sin (phi), cos (phi))
*** ./scripts/plot/__go_draw_axes__.m.orig8     2007-12-17 23:11:13.720293355 
+0100
--- ./scripts/plot/__go_draw_axes__.m   2007-12-17 23:36:21.813677686 +0100
***************
*** 185,190 ****
--- 185,193 ----
      else
        xaxisloc = "x";
        xaxisloc_using = "x1";
+       if (strcmpi (axis_obj.xaxislocation, "zero"))
+       fputs (plot_stream, "set xzeroaxis;\n");
+       endif
      endif
      if (strcmpi (axis_obj.yaxislocation, "right"))
        yaxisloc = "y2";
***************
*** 192,197 ****
--- 195,203 ----
      else
        yaxisloc = "y";
        yaxisloc_using = "y1";
+       if (strcmpi (axis_obj.yaxislocation, "zero"))
+       fputs (plot_stream, "set yzeroaxis;\n");
+       endif
      endif
  
      have_grid = false;
***************
*** 1470,1501 ****
  function do_tics (obj, plot_stream, ymirror, mono)
    if (strcmpi (obj.xaxislocation, "top"))
      do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x2", plot_stream, true, mono);
      do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x", plot_stream, true, mono);
    else
      do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x", plot_stream, true, mono);
      do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x2", plot_stream, true, mono);
    endif
    if (strcmpi (obj.yaxislocation, "right"))
      do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y2", plot_stream, ymirror, mono);
      do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y", plot_stream, ymirror, mono);
    else
      do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y", plot_stream, ymirror, mono);
      do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y2", plot_stream, ymirror, mono);
    endif
    do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel,
!            obj.zcolor, "z", plot_stream, true, mono);
  endfunction
  
  function do_tics_1 (ticmode, tics, labelmode, labels, color, ax,
!                   plot_stream, mirror, mono)
    colorspec = get_text_colorspec (color, mono);
    if (strcmpi (ticmode, "manual"))
      if (isempty (tics))
--- 1476,1517 ----
  function do_tics (obj, plot_stream, ymirror, mono)
    if (strcmpi (obj.xaxislocation, "top"))
      do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x2", plot_stream, true, mono, "border");
!     do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x", plot_stream, true, mono, "border");
!   elseif (strcmpi (obj.xaxislocation, "zero"))
!     do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x", plot_stream, true, mono, "axis");
      do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x2", plot_stream, true, mono, "axis");
    else
      do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x", plot_stream, true, mono, "border");
      do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
!              obj.xcolor, "x2", plot_stream, true, mono, "border");
    endif
    if (strcmpi (obj.yaxislocation, "right"))
      do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y2", plot_stream, ymirror, mono, "border");
!     do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y", plot_stream, ymirror, mono, "border");
!   elseif (strcmpi (obj.xaxislocation, "zero"))
!     do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y", plot_stream, ymirror, mono, "axis");
      do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y2", plot_stream, ymirror, mono, "axis");
    else
      do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y", plot_stream, ymirror, mono, "border");
      do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
!              obj.ycolor, "y2", plot_stream, ymirror, mono, "border");
    endif
    do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel,
!            obj.zcolor, "z", plot_stream, true, mono, "border");
  endfunction
  
  function do_tics_1 (ticmode, tics, labelmode, labels, color, ax,
!                   plot_stream, mirror, mono, axispos)
    colorspec = get_text_colorspec (color, mono);
    if (strcmpi (ticmode, "manual"))
      if (isempty (tics))
***************
*** 1510,1518 ****
        nlabels = numel (labels);
        fprintf (plot_stream, "set format %s \"%%s\";\n", ax);
        if (mirror)
!         fprintf (plot_stream, "set %stics (", ax);
        else
!         fprintf (plot_stream, "set %stics nomirror (", ax);
        endif
        labels = regexprep(labels, "%", "%%");
        for i = 1:ntics
--- 1526,1534 ----
        nlabels = numel (labels);
        fprintf (plot_stream, "set format %s \"%%s\";\n", ax);
        if (mirror)
!         fprintf (plot_stream, "set %stics %s (", ax, axispos);
        else
!         fprintf (plot_stream, "set %stics %s nomirror (", ax, axispos);
        endif
        labels = regexprep(labels, "%", "%%");
        for i = 1:ntics
***************
*** 1531,1539 ****
      else
        fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
        if (mirror)
!       fprintf (plot_stream, "set %stics (", ax);
        else
!       fprintf (plot_stream, "set %stics nomirror (", ax);
        endif
        fprintf (plot_stream, " %g,", tics(1:end-1));
        fprintf (plot_stream, " %g);\n", tics(end));
--- 1547,1555 ----
      else
        fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
        if (mirror)
!       fprintf (plot_stream, "set %stics %s (", ax, axispos );
        else
!       fprintf (plot_stream, "set %stics %s nomirror (", ax, axispos);
        endif
        fprintf (plot_stream, " %g,", tics(1:end-1));
        fprintf (plot_stream, " %g);\n", tics(end));
***************
*** 1541,1549 ****
    else
      fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
      if (mirror)
!       fprintf (plot_stream, "set %stics %s;\n", ax, colorspec);
      else
!       fprintf (plot_stream, "set %stics nomirror %s;\n", ax, colorspec);
      endif
    endif
  endfunction
--- 1557,1566 ----
    else
      fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
      if (mirror)
!       fprintf (plot_stream, "set %stics %s %s;\n", ax, axispos, colorspec);
      else
!       fprintf (plot_stream, "set %stics %s nomirror %s;\n", ax, 
!              axispos, colorspec);
      endif
    endif
  endfunction
*** ./scripts/plot/compass.m.orig8      2007-12-17 22:03:31.248923108 +0100
--- ./scripts/plot/compass.m    2007-12-17 22:49:53.316982877 +0100
***************
*** 0 ****
--- 1,118 ----
+ ## 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} {} compass (@var{u}, @var{v})
+ ## @deftypefnx {Function File} {} compass (@var{z})
+ ## @deftypefnx {Function File} {} compass (@dots{}, @var{style})
+ ## @deftypefnx {Function File} {} compass (@var{h}, @dots{})
+ ## @deftypefnx {Function File} address@hidden =} compass (@dots{})
+ ##
+ ## Plot the @code{(@var{u}, @var{v})} components of a vector field emanating
+ ## from the origin of a polar polt. If a single complex argument @var{z} is 
+ ## given, then @address@hidden = real (@var{z})} and @address@hidden = imag 
+ ## (@var{z})}.
+ ##
+ ## The style to use for the plot can be defined with a line style @var{style}
+ ## in a similar manner to the line styles used with the @code{plot} command.
+ ##
+ ## 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
+ ## a = toeplitz([1;randn(9,1)],[1,randn(1,9)]);
+ ## compass (eig (a))
+ ## @end group
+ ## @end example
+ ##
+ ## @seealso{plot, polar, quiver, feather}
+ ## @end deftypefn
+ 
+ function retval = compass (varargin)
+ 
+   [h, varargin, nargin] = __plt_get_axis_arg__ ("compass", varargin{:});
+ 
+   arrowsize = 0.25;
+   firstnonnumeric = Inf;
+   for i = 1:nargin
+     if (! isnumeric (varargin{i}))
+       firstnonnumeric = i;
+       break;
+     endif
+   endfor
+ 
+   if (nargin < 2 || firstnonnumeric < 2)
+     ioff = 2;
+     z = varargin {1} (:) .';
+     u = real (z);
+     v = imag (z);
+   else
+     ioff = 3;
+     u = varargin {1} (:) .';
+     v = varargin {2} (:) .';
+   endif
+ 
+   line_spec = "b-";
+   while (ioff <= nargin)
+     arg = varargin{ioff++};
+     if ((isstr (arg) || iscell (arg)) && ! have_line_spec)
+       [linespec, valid] = __pltopt__ ("compass", arg, false);
+       if (valid)
+       line_spec = arg;
+       break;
+       else
+       error ("compass: invalid linespec");
+       endif
+     else
+       error ("compass: unrecognized argument");
+     endif
+   endwhile
+ 
+   ## Matlab draws compass plots, with the arrow head as one continous 
+   ## line, and each arrow separately. This is completely different than 
+   ## quiver and quite ugly.
+   n = length (u);
+   xend = u;
+   xtmp = u .* (1 - arrowsize);
+   yend = v;
+   ytmp = v .* (1 - arrowsize);
+   x = [zeros(1, n); xend; xtmp  - v * arrowsize / 3; xend; ...
+        xtmp + v * arrowsize / 3];
+   y = [zeros(1, n); yend; ytmp  + u * arrowsize / 3; yend; ...
+        ytmp - u * arrowsize / 3];
+   [r, p] = cart2pol (x, y);
+ 
+   oldh = gca ();
+   unwind_protect
+     axes (h);
+     newplot ();
+     hlist = polar (h, r, p, line_spec);
+   unwind_protect_cleanup
+     axes (oldh);
+   end_unwind_protect
+ 
+   if (nargout > 0)
+     retval = hlist;
+   endif
+ 
+ endfunction
+ 
+ %!demo
+ %! a = toeplitz([1;randn(9,1)],[1,randn(1,9)]);
+ %! compass (eig (a))
*** ./scripts/plot/Makefile.in.orig8    2007-12-17 22:03:50.762815289 +0100
--- ./scripts/plot/Makefile.in  2007-12-17 22:05:09.471346943 +0100
***************
*** 78,83 ****
--- 78,84 ----
    close.m \
    closereq.m \
    colorbar.m \
+   compass.m \
    contour3.m \
    contour.m \
    contourc.m \
***************
*** 86,91 ****
--- 87,93 ----
    drawnow.m \
    ellipsoid.m \
    errorbar.m \
+   feather.m \
    figure.m \
    fill.m \
    findobj.m \
***************
*** 124,129 ****
--- 126,132 ----
    quiver3.m \
    replot.m \
    ribbon.m \
+   rose.m \
    scatter.m \
    scatter3.m \
    semilogx.m \
2007-12-15  David Bateman  <address@hidden>

        * plot/rose.m, plot/feather.m, plot/compass.m: New functions
        * plot/Makefiles (SOURCES): Add them to the sources
        * plot/polar.m: Set the x and y limits to the maximum polar
        radius. Set the axes to be square.
        * plot/__go_draw_axes__.m: Allow {x|y}axislocation to be "zero"
        and print axis at zero if this is used.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]