GNUPLOT: Why use a TEMP file???

Prem Rachakonda prem at engr.uky.edu
Tue May 29 16:20:58 EDT 2001


Hi,
  In the test.py of the GnuPlot why do you require to use a file
operation. Since in the piece of code given below, the instance
'file1' is never used as an input to any of the functions.
  Also, why is it required to save 'f.write('%s %s %s\n' % (x,
math.cos(x), math.sin(x)))' the Sin and Cosine values of x. What if we
wanted an exp value.

Prem.
  

   In the
.........
....
 # Make a temporary file:
    filename1 = tempfile.mktemp()
    f = open(filename1, 'w')
    for x in Numeric.arange(100)/5. - 10.:
        f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x)))
    f.close()
    # ensure that file will be deleted upon exit:
    file1 = Gnuplot.PlotItems.TempFile(filename1)

    print '############### test Func
########################################'
    wait('Plot a gnuplot-generated function')
    g.plot(Gnuplot.Func('sin(x)'))

    wait('Set title and axis labels and try replot()')
    g.title('Title')
    g.xlabel('x')
    g.ylabel('y')
    g.replot()
.......
...



More information about the Python-list mailing list