changeset 6446:f82f516c8a00

[project @ 2007-03-23 21:20:21 by jwe]
author jwe
date Fri, 23 Mar 2007 21:20:21 +0000
parents 407c08a8e5b7
children 3f79532415b5
files scripts/ChangeLog scripts/control/base/bode.m scripts/sparse/spy.m
diffstat 3 files changed, 15 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Mar 23 19:20:12 2007 +0000
+++ b/scripts/ChangeLog	Fri Mar 23 21:20:21 2007 +0000
@@ -1,5 +1,7 @@
 2007-03-23  John W. Eaton  <jwe@octave.org>
 
+	* sparse/spy.m: Update plotting code.
+
 	* plot/__pltopt1__.m: Handle "@" marker same as "+".
 	Handle numeric color specs.
 	* plot/plot.m: Remove "-@" and "@" from docstring.
--- a/scripts/control/base/bode.m	Fri Mar 23 19:20:12 2007 +0000
+++ b/scripts/control/base/bode.m	Fri Mar 23 21:20:21 2007 +0000
@@ -141,18 +141,13 @@
 
   ## Get the magnitude and phase of f.
   mag = abs(f);
-  phase = arg(f)*180.0/pi;
+  phase = unwrap (arg(f)*180.0/pi);
 
   if (nargout < 1),
     ## Plot the information
     save_automatic_replot = automatic_replot;
     unwind_protect
       automatic_replot(0);
-      oneplot();
-      __gnuplot_set__ autoscale;
-      __gnuplot_set__ nokey;
-      clearplot();
-      __gnuplot_set__ data style lines;
       if(is_digital(sys))
 	xlstr = ["Digital frequency w=rad/sec.  pi/T=",num2str(pi/systsam)];
 	tistr = "(exp(jwT)) ";
@@ -200,8 +195,6 @@
 	   "), u=", inname{1},", y=",outname{1}]);
 	grid("on");
 	semilogx(w,phase);
-	## This should be the default for subsequent plot commands.
-	oneplot();
       endif
     unwind_protect_cleanup
       automatic_replot(save_automatic_replot);
--- 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