x = arange(10, typecode=Float)
y = x**2

import plplot

plplot.plsdev("xwin")
plplot.plinit()
plplot.plenv(min(x), max(x), min(y), max(y), 0, 1)
plplot.pllab("x", "x**2", "Example 2D plot")
plplot.plline(x, y)
plplot.plend()

# to save as well, have to set everything up again, and replot
# save as png
plplot.plsdev("png")
plplot.plsfnam("simplePlotExample.png")
plplot.plinit()
plplot.plenv(min(x), max(x), min(y), max(y), 0, 1)
plplot.pllab("x", "x**2", "Example 2D plot")
plplot.plline(x, y)
plplot.plend()

# save as postscript
plplot.plsdev("psc")
plplot.plsfnam("simplePlotExample.ps")
plplot.plinit()
plplot.plenv(min(x), max(x), min(y), max(y), 0, 1)
plplot.pllab("x", "x**2", "Example 2D plot")
plplot.plline(x, y)
plplot.plend()
Exemple #2
0
xMax = max(x)

yMin = min(y)
yMax = max(y)

plplot.plsdev("xwin")
plplot.plinit()
plplot.plenv(xMin, xMax, yMin, yMax, 0, 1)
plplot.pllab("x", "y", "Example shaded contour plot")
plshades(zz, shedge, fill_width, 1, pltr1, xg1, yg1)

zmin = min(zz.flat)
zmax = max(zz.flat)

clevel = zmin + (zmax - zmin) * (arrayrange(NS)+0.5)/NS
shedge = zmin + (zmax - zmin) * (arrayrange(NS+1))/NS

plplot.plend()

# to save as well, have to set everything up again, and replot
# save as png
plplot.plsdev("png")
plplot.plsfnam("contourPlot.png")
plplot.plinit()
plplot.plenv(xMin, xMax, yMin, yMax, 0, 1)
plplot.pllab("x", "y", "Example shaded contour plot")
plplot.plline(x, y1)
plplot.plend()

# vim: expandtab shiftwidth=4:
Exemple #3
0
plplot.plinit()
plplot.plenv(xMin2D, xMax2D, yMin2D, yMax2D, 0, -2)
plplot.plw3d(basex, basey, height, 
	xMin, xMax, yMin, yMax, zMin, zMax, 
	alt, az)
plplot.plmtex("t", 1.0, 0.5, 0.5, "Example surface plot")
plplot.plbox3("bnstu", "x axis", 0.0, 0, 
	"bnstu", "y axis", 0.0, 0, 
	"bcdmnstuv", "z axis", 0.0, 0)
plplot.plsurf3d(x, y, z, 0, ())
plplot.plend()

# to save as well, have to set everything up again, and replot
# save as png
plplot.plsdev("png")
plplot.plsfnam("surfacePlot.png")
plplot.plinit()
plplot.plenv(xMin2D, xMax2D, yMin2D, yMax2D, 0, -2)
plplot.plw3d(basex, basey, height, 
	xMin, xMax, yMin, yMax, zMin, zMax, 
	alt, az)
plplot.plmtex("t", 1.0, 0.5, 0.5, "Example surface plot")
plplot.plbox3("bnstu", "x axis", 0.0, 0, 
	"bnstu", "y axis", 0.0, 0, 
	"bcdmnstuv", "z axis", 0.0, 0)
plplot.plsurf3d(x, y, z, 0, ())
plplot.plend()


# vim: expandtab shiftwidth=4:
xMin = min(x)
xMax = max(x)

# determine the global min and max of all the y's
yAll = concatenate( [y1, y2, y3] )

yMin = min(yAll)
yMax = max(yAll)

plplot.plsdev("xwin")
plplot.plinit()
plplot.plenv(xMin, xMax, yMin, yMax, 0, 1)
plplot.pllab("x", "y", "Example 2D plot")
plplot.plline(x, y1)
plplot.plline(x, y2)
plplot.plline(x, y3)
plplot.plend()

# to save as well, have to set everything up again, and replot
# save as png
plplot.plsdev("png")
plplot.plsfnam("multiCurveLinePlot.png")
plplot.plinit()
plplot.plenv(xMin, xMax, yMin, yMax, 0, 1)
plplot.pllab("x", "y", "Example 2D plot")
plplot.plline(x, y1)
plplot.plline(x, y2)
plplot.plline(x, y3)
plplot.plend()