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)
def main(w): x = (arange(XPTS) - (XPTS / 2)) / float(XPTS / 2) y = (arange(YPTS) - (YPTS / 2)) / float(YPTS / 2) x = 1.5*x y = 0.5 + y x.shape = (-1,1) r2 = (x*x) + (y*y) z = (1. - x)*(1. - x) + 100 * (x*x - y)*(x*x - y) # The log argument may be zero for just the right grid. */ z = log(choose(greater(z,0.), (exp(-5.), z))) x.shape = (-1,) zmin = min(z.flat) zmax = max(z.flat) nlevel = 10 step = (zmax-zmin)/(nlevel+1) clevel = zmin + step + arange(nlevel)*step w.plschr(0., 1.8) w.plwidth(1) w.pladv(0) w.plvpor(0.0, 1.0, 0.0, 1.0) w.plwind(-0.43, 0.840, 0.05, 0.48) w.plcol0(1) w.plw3d(1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt, az) w.plbox3("bnstu", "", 0.0, 0, "bnstu", "", 0.0, 0, "bcdmnstuv", "", 0.0, 0) # If converting the -dev svg result later with the ImageMagick # "convert" application or viewing the svg result with the ImageMagick # "display" application must compensate for the librsvg-2.22 # positioning bug since librsvg is what ImageMagick uses # to interpret SVG results. if_rsvg_bug = True if if_rsvg_bug: shift = 1.00 else: shift = 1.07 w.plmtex3("zs", 5.0, shift, 1.0, "z axis") w.plcol0(2) # magnitude colored plot with faceted squares cmap1_init(w, 0) w.plsurf3d(x, y, z, w.MAG_COLOR | w.FACETED, ()) # Shading to provide a good background for legend. x1 = 0.10 x2 = 0.8 w.plvpor(0.0, 1.0, 0.0, 1.0) w.plwind(0.0, 1.0, 0.0, 1.0) # Completely opaque from 0. to x1 w.plscol0a(15, 0, 0, 0, 1.0) w.plcol0(15) x=array([0., 0., x1, x1]) y=array([0., 1., 1., 0.]) w.plfill(x,y) # Black transparent gradient. pos = array([0.0, 1.0]) rcoord = array([0.0, 0.0]) gcoord = array([0.0, 0.0]) bcoord = array([0.0, 0.0]) acoord = array([1.0, 0.0]) rev = array([0, 0]) w.plscmap1n(2) w.plscmap1la(1, pos, rcoord, gcoord, bcoord, acoord, rev) x=array([x1, x1, x2, x2]) w.plgradient(x,y,0.) # Logo Legend w.plscol0a(15, 255, 255, 255, 1.0) w.plcol0(15) x1 = 0.03 w.plschr(0., 2.9) w.plsfont(w.PL_FCI_SANS, w.PL_FCI_UPRIGHT, w.PL_FCI_BOLD) w.plptex(x1, 0.57, 1.0, 0.0, 0.0, "PLplot") w.plschr(0., 1.5) w.plptex(x1, 0.30, 1.0, 0.0, 0.0, "The ultimate in cross-platform plotting")
#!/usr/bin/env python # Simple test of plfill for the case where the polygon is just outside the # window. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys import plplot as w from numpy import * # Parse and process command line arguments w.plparseopts(sys.argv, w.PL_PARSE_FULL) # Initialize plplot w.plinit() w.plcol0(2) w.pladv(0) w.plvpor(0.1, 0.9, 0.1, 0.9) xmin, xmax, ymin, ymax = (0., 1., 0., 1.) w.plwind(xmin, xmax, ymin, ymax) # Just to show edges of viewport w.plbox("bc", 0., 0, "bc", 0., 0) w.plcol0(1) eps = 0.001 xmin, xmax, ymin, ymax = (xmin - eps, xmax + eps, ymin - eps, ymax + eps) x = (xmin, xmax, xmax, xmin) y = (ymin, ymin, ymax, ymax) w.plfill(x, y) w.plend()