[Top] [Prev] [Next] [Bottom]

3.5 Polymap Objects

Currently Polymap objects are only available in PyGist.

Instantiation

from polymap import *
pm = Polymap ( <keylist>)

Description

A Polymap is a set of arbitrary color-filled polygons. The allowed keywords are

x, y, n, z, hide, label

In addition, like all 2d geometric classes, Polymaps have the methods set and new.

Keyword Arguments

The following keyword arguments can be specified for Polymaps:

x = <sequence of floating point values>
y = <sequence of floating point values>
These are the coordinates of the vertices of the polygons. (The way this data is set up, vertices of adjacent polygons will be repeated.)
n = <sequence of integer values>
Entry n [i] in this array tells how many vertices polygon i has. Thus the first n [0] entries in x and y are the vertices of the first polygon, the next n [1] entries, of the second, etc. The sum of all the entries in n is the length of vectors x and y.
z = <sequence of numerical or unsigned character values> (this vector is the same length as n) tells how to color the polygons. Numbers are interpolated into a palette; the integer values of unsigned characters (Python typecode 'b')are used as indices into the palette.
hide = 0/1--(1 to hide this part of the graph)
label = <string>--label for this part of the graph.

Methods new and set have the same function as in the other 2d classes.

Example

The following simple polymap example shows something like a stained glass window.

from polymap import *
n = array ( [4, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3])
x = array ( [0., 1., 1., 0., 0., 1.5, 1., 1.5, 3., 0., 1.5,
3., 2., 1.5, 2., 1., 2., 3., 3., 2., 1., 2., 2., 1., 2.,
3., 1.5, 1., 2., 1.5, 1., 1.5, 0., 0., 3., 1.5])
y = [1., 2., 7., 8., 1., 1., 2., 0., 1., 1., 1., 1., 2., 1.,
2., 2., 2., 1., 8., 7., 2., 2., 7., 7., 7., 8., 8., 7.,
7., 8., 7., 8., 8., 8., 8., 9.])
z = array ( [2.5, 1.2, 1.5, 1.2, .5, 2.5, 2., 1.2, .5, 1.2,
1.5])
p1 = Polymap (x = x, y = y, z = z, n = n)
g0 = Graph2d (p1, titles = "Stained glass window")
g0.plot ()



[Top] [Prev] [Next] [Bottom]

support@icf.llnl.gov
Copyright © 1997,Regents of the University of California. All rights reserved.