[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: save and reload plots

From: James R. Phillips
Subject: Re: save and reload plots
Date: Thu, 13 Oct 2005 10:46:43 -0700 (PDT)

--- Corbin Champion wrote:

> How do I save and restore plots:
> Ideally, I want to be able to create plots - I am using gnuplot as is most 
> common
> Save all current figures
> Save workspace from before
> quit octave
> Open octave
> Load workspace from before
> load all figures from before
> Be able to view or modify plots as I could if I didn't quit the first 
> session
> I would like to have things like the hold state (ie hold on) etc preserved 
> from before as well.
> Could someone describe how this can be done?
> Thanks in advance for any help!
> Corbin

You may not like this kind of help, but basically it isn't possible to do what
you want to do.  You can save a script that creates a plot; you can save the
output of the plot in a postscript file, but you can't save the state of
gnuplot and resume it.  It isn't designed to achieve that goal.

To come some ways toward achieving your goal, always create your plots from a
script, say make_plots.m.  Keep your script, and you can use it to
recreate/modify the plots.  Modify your plot by continually modifying your
script, and re-running it until the plot looks like you want it to look.

It is often useful to segment computational tasks, saving the state of the task
at convenient points.  Thus, do most of the computations, and save the results 
as an octave data file.  Then start the plotting task by loading the saved
results, and running the plot script.  In this way modifying the plots does not
require redoing all the computations.

I like to further automate my analyses by using gnu make with octave, putting
octave commands in a makefile.  See e.g.

The key to using gnuplot effectively is to "think like gnuplot".  You might
want to look at the gnuplot "not so frequently asked questions":

Good luck.  


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]