From help-octave-request at bevo dot che dot wisc dot edu Wed Feb 4 00:30:38 1998 Subject: Switching between multi-plots From: "John W. Eaton" To: efh at nessie dot mcc dot ac dot uk Cc: help-octave at bevo dot che dot wisc dot edu Date: Wed, 4 Feb 1998 00:30:36 -0600 On 3-Feb-1998, Ted Harding wrote: | With the multiplot facilities of gnuplot-3.6, an enhancement to the | "figure()" command would be useful. | | Suppose, for instance, you have already plotted "figure(1)" and then | something else in "figure(2)". | | Now you switch back using the command "figure(1)". As far as I can | see, the only effect of this is to redirect plot output to window 1: | all of the plotting environment of window 2 (including the datafile | just plotted) is still in force. In particular, a "replot" command | will now put a copy of window 2 into window 1. Yes. | What I would ideally like is that, after "figure(1)", the original | environment of window 1 is restored (so that, for instance, a | "replot" would re-draw the original window 1). [...] Yes, this would be useful. | I can think of a number of ways to enhance the "figure" function in | order to partially achieve this, though I'm not seeing how to keep | track of the datafile being plotted (which is a temp file with a | random name). | Alternatively, wrapping the octave "plot" function in | a script which would keep track of these things is also feasible, | but would be more complicated. Any attempt to keep track of these things directly within Octave seems like it would be a lot of work (it would require duplicating large portions of gnpulot in Octave, which doesn't seem like a very good solution to me -- there is already enough duplication in that Octave has to parse the plotting commands). | I'm raising this for discussion: I think it would be a very useful | enhancement, but I'm really unclear about the best way to approach | it and would welcome other people's ideas. If anything useful comes | of it, then I'll happily put it up for others to use. | | I suppose the best solution would be for gnuplot itself to restore | the environment when you switch windows, but as far as I can see it | will do nothing of the sort. One possibility is to modify the figure command to save and restore gnuplot's state using gnuplot's save and load commands. Before reloading it, you would probably want to strip out some of the saved commands (like the plot commands, so that executing figure doesn't force a replot to occur) or maybe extract some information from them (like the datafile(s) that are in use). One problem would be that users might perceive some set commands (for example, set terminal) as global options, but the changes would be wiped out the next time figure was executed. It might require a bit more work to allow users to specify which options are intended to be global or local to one (or several) plot windows. Implementing this feature would require adding gsave and gload functions to Octave, but that would be relatively easy. However, I'm not sure I'm really all that interested in it, since I'm thinking more about moving to something other than gnuplot for graphics. If you'd like to discuss graphics for Octave, please join the octave-maintainers mailing list and post ideas there. Thanks, jwe