home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fb.zip / octave / SCRIPTS.ZIP / scripts / plot / figure.m < prev    next >
Text File  |  1999-11-20  |  2KB  |  62 lines

  1. ## Copyright (C) 1996, 1997 John W. Eaton
  2. ##
  3. ## This file is part of Octave.
  4. ##
  5. ## Octave is free software; you can redistribute it and/or modify it
  6. ## under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation; either version 2, or (at your option)
  8. ## any later version.
  9. ##
  10. ## Octave is distributed in the hope that it will be useful, but
  11. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. ## General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with Octave; see the file COPYING.  If not, write to the Free
  17. ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  18. ## 02111-1307, USA.
  19.  
  20. ## -*- texinfo -*-
  21. ## @deftypefn {Function File} {} figure (@var{n})
  22. ## Set the current plot window to plot window @var{n}.  This function
  23. ## currently requires X11 and a version of gnuplot that supports multiple
  24. ## frames.
  25. ## @end deftypefn
  26.  
  27. ## Author: jwe
  28.  
  29. function f = figure (n)
  30.  
  31.   static figure_list = create_set (0);
  32.   static figure_called = 0;
  33.  
  34.   if (nargin == 0)
  35.     f = max (figure_list) + 1;
  36.   else
  37.     f = n;
  38.   endif
  39.  
  40.   if (nargin < 2)
  41.     if (gnuplot_has_frames)
  42.       if (! isempty (getenv ("DISPLAY")))
  43.     oneplot ();
  44.     figure_list = union (figure_list, f);
  45.     eval (sprintf ("gset term x11 %d\n", f));
  46.       else
  47.     error ("figure: requires X11 and valid DISPLAY");
  48.       endif
  49.     else
  50.       error ("figure: gnuplot doesn't appear to support this feature");
  51.     endif
  52.   elseif (rem (nargin, 2) == 0)
  53.     if (! figure_called)
  54.       figure_called = 1;
  55.       warning ("figure: setting figure properties is unsupported");
  56.     endif
  57.   else
  58.     usage ("figure (n)");
  59.   endif
  60.  
  61. endfunction
  62.