[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reversal of axis in spy
From: |
David Bateman |
Subject: |
Re: reversal of axis in spy |
Date: |
Mon, 07 May 2007 21:34:15 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
John W. Eaton wrote:
> On 7-May-2007, David Bateman wrote:
>
> | With the changes for the graphic handles, spy had its y axis reversed.
> | This patch puts things back to normal..
>
> I applied this patch.
>
> Thanks,
>
> jwe
>
I think I'd also be inclined to apply the attached patch, to make spy
more compatible
D.
Index: scripts/sparse/spy.m
===================================================================
RCS file: /usr/local/cvsroot/octave/scripts/sparse/spy.m,v
retrieving revision 1.7
diff -u -r1.7 spy.m
--- scripts/sparse/spy.m 7 May 2007 17:09:38 -0000 1.7
+++ scripts/sparse/spy.m 7 May 2007 19:29:46 -0000
@@ -17,10 +17,32 @@
## -*- texinfo -*-
## @deftypefn {Function File} {} spy (@var{x})
-## Plot the sparsity pattern of the sparse matrix @var{x}.
+## @deftypefnx {Function File} {} spy (@dots{}, @var{markersize})
+## @deftypefnx {Function File} {} spy (@dots{}, @var{LineSpec})
+## Plot the sparsity pattern of the sparse matrix @var{x}. If the argument
+## @var{markersize} is given as an scalar value, it is used to determine the
+## point size in the plot. If the string @var{LineSpec} is given it is
+## passed to @code{plot} and determines the appearance of the plot.
+## @seealso{plot}
## @end deftypefn
-function spy (S)
+function spy (S, varargin)
+
+ markersize = NaN;
+ if (numel (i) < 1000)
+ LineSpec = "*";
+ else
+ LineSpec = ".";
+ endif
+ for i = 1:length(varargin)
+ if (ischar(varargin{i}))
+ LineSpec = varargin{i};
+ elseif (isscalar (varargin{i}))
+ markersize = varargin{i};
+ else
+ error ("spy: expected markersize or linespec");
+ endif
+ endfor
if (issparse (S))
[i, j, s, m, n] = spfind (S);
@@ -29,10 +51,10 @@
[m, n] = size (S);
endif
- if (numel (i) < 1000)
- plot (j, i, "*");
+ if (isnan (markersize))
+ plot (j, i, LineSpec);
else
- plot (j, i, ".");
+ plot (j, i, LineSpec, "MarkerSize", markersize);
endif
axis ([0, n+1, m+1, 0]);