# HG changeset patch # User dbateman # Date 1178567867 0 # Node ID 98724cae69c751740e2d1b440cd03b64b4a2d11f # Parent 2c19eaa2c6f7336f88cdea89f850dca173fe2a68 [project @ 2007-05-07 19:57:47 by dbateman] diff -r 2c19eaa2c6f7 -r 98724cae69c7 scripts/ChangeLog --- a/scripts/ChangeLog Mon May 07 17:09:38 2007 +0000 +++ b/scripts/ChangeLog Mon May 07 19:57:47 2007 +0000 @@ -1,6 +1,7 @@ 2007-05-07 David Bateman - * sparse/spy.m: Reverse Y axis for new graphics code. + * sparse/spy.m: Reverse Y axis for new graphics code. Make more + compatiable, accepting LineSpec and markersize arguments. 2007-05-02 John W. Eaton diff -r 2c19eaa2c6f7 -r 98724cae69c7 scripts/sparse/spy.m --- a/scripts/sparse/spy.m Mon May 07 17:09:38 2007 +0000 +++ b/scripts/sparse/spy.m Mon May 07 19:57:47 2007 +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]);