diff scripts/sparse/spy.m @ 6446:f82f516c8a00

[project @ 2007-03-23 21:20:21 by jwe]
author jwe
date Fri, 23 Mar 2007 21:20:21 +0000
parents ddfe04062467
children 2c19eaa2c6f7
line wrap: on
line diff
--- a/scripts/sparse/spy.m	Fri Mar 23 19:20:12 2007 +0000
+++ b/scripts/sparse/spy.m	Fri Mar 23 21:20:21 2007 +0000
@@ -20,32 +20,21 @@
 ## Plot the sparsity pattern of the sparse matrix @var{x}.
 ## @end deftypefn
 
-function spy(S) 
-  if issparse(S)
-    [i,j,s,m,n]= spfind(S);
+function spy (S) 
+
+  if (issparse (S))
+    [i, j, s, m, n] = spfind (S);
   else
-    [i,j,s] = find(S);
-    [m,n] = size(S);
+    [i, j, s] = find (S);
+    [m, n] = size (S);
   endif
 
-  arp = automatic_replot;
-  unwind_protect
-    automatic_replot (0);
-
-    eval(sprintf('__gnuplot_set__ nokey'))
-    eval(sprintf('__gnuplot_set__ yrange [0:%d] reverse',m+1))
-    eval(sprintf('__gnuplot_set__ xrange [0:%d] noreverse',n+1))
+  if (numel (i) < 1000)
+    plot (j, i, "*");
+  else
+    plot (j, i, ".");
+  endif
 
-    if (length(i)<1000)
-      plot(j,i,'*');
-    else
-      plot(j,i,'.');
-    endif
+  axis ([0, n+1, 0, m+1]);
 
-    #TODO: we should store the reverse state so we don't undo it
-    __gnuplot_set__ yrange [0:1] noreverse
-    axis;
-  unwind_protect_cleanup
-    automatic_replot (arp);
-  end_unwind_protect
 endfunction