|
From: <mh...@us...> - 2012-12-06 09:23:43
|
Revision: 323
http://gnuplot-py.svn.sourceforge.net/gnuplot-py/?rev=323&view=rev
Author: mhagger
Date: 2012-12-06 09:23:32 +0000 (Thu, 06 Dec 2012)
Log Message:
-----------
Use "print" in a way that is compatible with Python 3.x.
Suggested by: Csaba Szepesvari <sze...@ua...>
Modified Paths:
--------------
trunk/demo.py
trunk/test.py
Modified: trunk/demo.py
===================================================================
--- trunk/demo.py 2011-11-19 14:51:51 UTC (rev 322)
+++ trunk/demo.py 2012-12-06 09:23:32 UTC (rev 323)
@@ -60,7 +60,7 @@
# support enhanced mode, set `enhanced=0' below.
g.ylabel('x^2') # take advantage of enhanced postscript mode
g.hardcopy('gp_test.ps', enhanced=1, color=1)
- print ('\n******** Saved plot to postscript file "gp_test.ps" ********\n')
+ print('\n******** Saved plot to postscript file "gp_test.ps" ********\n')
raw_input('Please press return to continue...\n')
g.reset()
Modified: trunk/test.py
===================================================================
--- trunk/test.py 2011-11-19 14:51:51 UTC (rev 322)
+++ trunk/test.py 2012-12-06 09:23:32 UTC (rev 323)
@@ -31,14 +31,14 @@
def wait(str=None, prompt='Press return to show results...\n'):
if str is not None:
- print str
+ print(str)
raw_input(prompt)
def main():
"""Exercise the Gnuplot module."""
- print (
+ print(
'This program exercises many of the features of Gnuplot.py. The\n'
'commands that are actually sent to gnuplot are printed for your\n'
'enjoyment.'
@@ -62,7 +62,7 @@
f.write('%s %s %s\n' % (x, math.cos(x), math.sin(x)))
f.close()
- print '############### test Func ###################################'
+ print('############### test Func ###################################')
wait('Plot a gnuplot-generated function')
g.plot(Gnuplot.Func('sin(x)'))
@@ -96,7 +96,7 @@
g.set_tics('x', 'auto')
g.plot(Gnuplot.Func('sin(x)', title='Sine of x'))
- print 'Change Func attributes after construction:'
+ print('Change Func attributes after construction:')
f = Gnuplot.Func('sin(x)')
wait('Original')
g.plot(f)
@@ -113,7 +113,7 @@
f.set_option(axes='x2y2')
g.plot(f)
- print '############### test File ###################################'
+ print('############### test File ###################################')
wait('Generate a File from a filename')
g.plot(Gnuplot.File(filename1))
@@ -140,7 +140,7 @@
wait('title="title"')
g.plot(Gnuplot.File(filename1, title='title'))
- print 'Change File attributes after construction:'
+ print('Change File attributes after construction:')
f = Gnuplot.File(filename1)
wait('Original')
g.plot(f)
@@ -154,7 +154,7 @@
f.set_option(title=None)
g.plot(f)
- print '############### test Data ###################################'
+ print('############### test Data ###################################')
x = numpy.arange(100)/5. - 10.
y1 = numpy.cos(x)
y2 = numpy.sin(x)
@@ -200,7 +200,7 @@
wait('title="Cosine of x"')
g.plot(Gnuplot.Data(d, title='Cosine of x'))
- print '############### test compute_Data ###########################'
+ print('############### test compute_Data ###########################')
x = numpy.arange(100)/5. - 10.
wait('Plot Data, computed by Gnuplot.py')
@@ -217,8 +217,8 @@
wait('with_="lp 4 4"')
g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, with_='lp 4 4'))
- print '############### test hardcopy ###############################'
- print '******** Generating postscript file "gp_test.ps" ********'
+ print('############### test hardcopy ###############################')
+ print('******** Generating postscript file "gp_test.ps" ********')
wait()
g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2',
title='cos(0.5*x^2)'))
@@ -258,7 +258,7 @@
wait('Testing hardcopy options: fontsize=20')
g.hardcopy('gp_test.ps', fontsize=20)
- print '******** Generating svg file "gp_test.svg" ********'
+ print('******** Generating svg file "gp_test.svg" ********')
wait()
g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2',
title='cos(0.5*x^2)'))
@@ -268,11 +268,11 @@
g.hardcopy('gp_test.ps', terminal='svg', enhanced='1')
- print '############### test shortcuts ##############################'
+ print('############### test shortcuts ##############################')
wait('plot Func and Data using shortcuts')
g.plot('sin(x)', d)
- print '############### test splot ##################################'
+ print('############### test splot ##################################')
wait('a 3-d curve')
g.splot(Gnuplot.Data(d, with_='linesp', inline=0))
wait('Same thing, saved to a file')
@@ -281,7 +281,7 @@
wait('Same thing, inline data')
g.splot(Gnuplot.Data(d, with_='linesp', inline=1))
- print '############### test GridData and compute_GridData ##########'
+ print('############### test GridData and compute_GridData ##########')
# set up x and y values at which the function will be tabulated:
x = numpy.arange(35)/2.0
y = numpy.arange(30)/10.0 - 1.5
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|