From bug-octave-request at bevo dot che dot wisc dot edu Thu Nov 13 10:09:12 1997 Subject: figure() fails in multiplot mode From: Kai Mueller To: bug-octave at bevo dot che dot wisc dot edu Date: Thu, 13 Nov 1997 17:09:02 +0100 Problem: figure(n) fails if gnuplot is in multiplot mode. ======== This happens when several diagrams are drawn in one window. Solution: leave multiplot node before "set term x11 (n)". ========= The new function "greset" is not necessary but I would like to have it in octave. ---------------------------- [1] octave.bin:3> step(jet707); [2] octave.bin:4> figure(1) gnuplot> set term x11 1 octave.bin:5> ^ line 0: You can't change the terminal in multiplot mode [3] octave.bin:5> gset nomultiplot [4] octave.bin:6> figure(1) [5] octave.bin:7> ---------------------------- [1] create a window in multiplot mode (step() and jet707() are from the Controls Toolbox). [2] current version of figure() cannot create window #1 before [3] multiplot mode is switched off. [4] everything is fine. The modified version of figure() below solves the problem (this is just an idea). --- modified version of figure.m --------------------------------------- ## Copyright (C) 1996 John W. Eaton ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. ## usage: figure (n) ## ## Set the current plot window to plot window N. This function ## currently requires X11 and a recent version of gnuplot. ## Author: jwe # $Revision: 1.2 $ # $Log: figure.m,v $ # Revision 1.2 1997/11/13 15:20:03 mueller # gset term x11 (n) fails if multiplot mode is enabled. # Reset gnuplot settings if greset exists. # # Revision 1.1 1997/11/13 09:33:26 mueller # Initial revision # function figure (n) if (nargin == 1) if (gnuplot_has_frames) if (! isempty (getenv ("DISPLAY"))) if (gnuplot_has_multiplot) gset nomultiplot endif # greset (m-file) should become an internal command. if (exist("greset") >= 2) greset; else disp("figure: no reset of graphics display."); endif eval (sprintf ("gset term x11 %d\n", n)); else error ("figure: requires X11 and valid DISPLAY"); endif else error ("figure: gnuplot doesn't appear to support this feature"); endif else usage ("figure (n)"); endif endfunction ------------------------------------------------------------------------ --- greset.m (ugly) ---------------------------------------------------- ## Copyright (C) 1996 John W. Eaton ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA ## 02111-1307, USA. ## ------------------------------------------------- ## usage: greset ## ## Reset all plot options to (octave) default values. ## This sould be implemented as an internal command. ## "greset" is similar to the gnuplot "reset". ## ------------------------------------------------- ## Author: Kai P. Mueller # $Revision: 1.1 $ # $Log: greset.m,v $ # Revision 1.1 1997/11/13 15:23:39 mueller # Initial revision # function greset() if (nargin != 0) usage("greset takes no arguments.") endif gset autoscale gset nogrid gset nokey gset nolabel gset nologscale gset nooffsets gset origin gset output gset nopolar gset size gset tics gset title gset view gset xdata gset ydata gset zdata gset xlabel gset ylabel gset zlabel endfunction ------------------------------------------------------------------------ The greset() function is not necessary but very useful. It should be considered as a suggestion. Sometimes diagrams look strange if a previous command disabled autoscale or set logscales. "greset" should be implemented as an internal command (perhaps as gnuplot "reset"). Kai -- Kai P. Mueller Control Department (Regelungstechnik) | Phone [+49] (531) 391-3835 Technical University Braunschweig | Fax [+49] (531) 391-5194 D-38092 Braunschweig | Email mueller at ifr dot ing dot tu-bs dot de