Exemplo n.º 1
0
    def plotHistogram(self):

        def plfbox(x0, y0):
            x = numpy.array([x0, x0, x0 + 1.0, x0 + 1.0])
            y = numpy.array([0.0, y0, y0, 0.0])
            plplot.plfill(x, y)
            plplot.plcol0(1)
            plplot.pllsty(1)
            plplot.plline(x, y)

        self.plot.clearWidget();

        y0 = numpy.array([5, 15, 12, 24, 28, 30, 20, 8, 12, 3])
        pos = numpy.array([0.0, 0.25, 0.5, 0.75, 1.0])
        red = numpy.array([0.0, 0.25, 0.5, 1.0, 1.0])
        green = numpy.array([1.0, 0.5, 0.5, 0.5, 1.0])
        blue = numpy.array([1.0, 1.0, 0.5, 0.25, 0.0])

	plplot.pladv(0)
	plplot.plvsta()
	
	plplot.plcol0(2)
	
	plplot.plwind(1980.0, 1990.0, 0.0, 35.0)
	plplot.plbox("bc", 1.0, 0, "bcnv", 10.0, 0)
	plplot.plcol0(2)
	plplot.pllab("Year", "Widget Sales (millions)", "#frPLplot Example 12")

 	plplot.plscmap1l(1,pos,red,green,blue)

	for i in range(10):
            plplot.plcol1(i/9.0)
            plplot.plpsty(0)
            plfbox((1980. + i), y0[i])
            string = "%.0f" % (y0[i])
            plplot.plptex((1980. + i + .5), (y0[i] + 1.), 1.0, 0.0, .5, string)
            string = "%d" % (1980 + i)
            plplot.plmtex("b", 1.0, ((i + 1) * .1 - .05), 0.5, string)
       
        self.update()
Exemplo n.º 2
0
This is the original code used to develop the plplot renderer module
"""

# set up some data to plot
from Numeric import *

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")
Exemplo n.º 3
0
    for j in range(len(y)):
	z[i,j] = x[i]*exp(-x[i]*x[i] - y[j]*y[j])

import plplot

# determine the min and max of x
xMin = min(x)
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()
Exemplo n.º 4
0
def pllab(xlabel, ylabel, tlabel):
    if PLPLOT:
        plg.pllab(xlabel, ylabel, tlabel)
    else:
        plg.pglab(xlabel, ylabel, tlabel)
Exemplo n.º 5
0
import plplot

# determine the min and max of x
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)