Using iCy-fLaME's suggestion I threw this together.
Example:
#directory I want to save to as str
fdir = geo+'/'+str(hidden)+'/'+trial+'/%netval.eps'
#set output add quotes
g1('set output '+'"'+fdir+'"') #note there was an extra 'set' (typo)
in previous example
#set terminal
g1('set terminal postscript landscape enhanced color')
#plot
g1.plot(r12, r1, Gnuplot.Func('-x + 1', title = "ave response%"),
Gnuplot.Func('x', title = "ave cut%"))
This seems to work well. Is this efficient, or what you refer to by
'set manually before plotting' ? I'd like to tighten up the time it
takes for report generation albeit a negligible % of the process time.
Thanks
Conor
On 11/9/06, Michael Haggerty <mh...@al...> wrote:
> Conor Robinson wrote:
> > I'm generating thousands of plots, which I'm storing as ps files as
> > records of different trials. For example:
> >
> > #plot my data
> > g2.plot(r22, r2, r21)
> >
> > #save results of a trial
> > g2.hardcopy(trial+'/result.ps', enhanced=1, color=1)
> >
> > What I would like to do is complete the plot in g2, but suppress the
> > visual output and just save a hardcopy to view later if need be.
> > Eventually, as expected, AquaTerm will crash as I keep displaying the
> > numerous plots. Is there a way to implement this?
>
> To prevent the terminal output, I think you could use the 'unknown'
> terminal type (which appears to send output to nirvana):
>
> import gp, Gnuplot
>
> # Set the term value that is restored after a hardcopy:
> gp.GnuplotOpts.default_term = 'unknown'
>
> g = Gnuplot.Gnuplot()
>
> # Set the initial term value:
> g('set term unknown')
>
> ...
>
> If you are very worried about efficiency, though, you can't really use
> the hardcopy() method at all because it causes the data to be processed
> twice (once for 'unknown' then once for your desired hardcopy output
> device). If that is a problem, you probably want to set the terminal
> and output file manually before plotting anything.
>
> Michael
>
|