PyPlotter - A Python/Jython Graph Plotting Package. Manual
5.3 Class Simplex.Diagram
Class Simplex.Diagram is a class for drawing simplex diagrams
of population dynamics of populations of three species. For simplex
diagrams dedicated to other purposes it is recommended to use the lower
level class Simplex.Plotter instead.
- (self, gfx, function, title=”Simplex Diagram”,
p1=”A”, p2=”B”, p3=”C”, styleFlags
raster = RASTER_DEFAULT, density = -1,
= (0.,1.,0.), color2 = (1.,0.,0.),
color3 = (0.,0.,1.), colorFunc
titlePen = Gfx.BLACK_PEN, labelPen = Gfx.BLACK_PEN,
Initializes the class with the following parameters:
- Gfx.Driver: The Gfx drivers used for drawing the simplex diagram.
- f(p)->p*, where p and p' are 3 tuples of floats that add up to 1.0:
Population dynamics function to be displayed in the simplex diagram.
- title, p1, p2, p3
- strings: Strings to mark the title and the three corners of the diagram
- integer, interpreted as a bitfield of flags: The style or rather flavour
of the simplex diagram. Presently three flavours are possible: VECTORS
for drawing the diagram as a vector field with many little arrows;
TRAJECTORIES for drawing pseudo trajectories; PATCHES
for drawing a patched diagram, where each point in the diagram has
a unique color in the beginning. From generation to generation, however,
colors are adjusted such that every point ("patch") takes the color
of the point it has moved to. This exposes areas of attraction in the
- list of points (3-tuples of floats that add up to 1.0): The point raster
of the simplex diagram. Suitable point rasters of varying density can
be produced with the functions Simplex.GenRaster and Simplex.RandomGrid.
- integer > 2: The density of the points of the simplex diagram. This
is mainly useful in combination with style PATCHES, because
this style does not use a raster.
- color1, color2, color3
- (r,g,b)-tuples, where r,g and b are floats in range of [0.0, 1.0]:
The three color parameters have a different meaning depending on the
diagram style used. For patch diagrams these are the edge colors of
the three edges of the diagram. For trajectory diagrams color1 is the
starting color and color2 is the color towards which later steps of
the trajectory are shaded. For vector fields the range between color1
and color2 is used to indicate the strength of the vector field.
- f(ca, cb, strength) -> c, where ca and cb are colors and strength is
a float from [0, infinity]: This function produces a color shade from
'ca', 'cb' and 'strength', usually somewhere on the line between 'ca'
and 'cb'. The parameter colorFunc is not used for patches
- titlePen, labelPen, simplexPen, backgroundPen
- Gfx.Pen: Pens for the respective parts of the simplex diagram.
- 4-tuple of floats from then range [0.0, 1.0]: the part of the screen
to be used for the diagram.
- (self, styleFlags=None, titlePen=None,
backgroundPen=None) - Changes the style of the simplex diagram. It
is not necessary to assign a value to all arguments of the functions.
Those arguments that no value is assigned to will leave the respective
class attributes untouched.
- (self, function) - Changes the population dynamics function that is
visualized by the diagram. The change will only be visible after the
method show has been called.
- (self, raster) - Changes the raster of sample points. The change will
only be visible after the method show has been called.
- (self, density) - Generates a raster of uniformly distributed sample
points (population distributions) with the given density. The change
will only be visible after the method show has been called.
- (self, color1 = (0.,1.,0.), color2 = (1.,0.,0.),
color3 = (0.,0.,1.),
colorFunc=scaleColor) - Changes the colors of diagram, including a
color modifying function. Note: The semantics of these paramters may
differ depending on the visualizer used. The change will only be visible
after the method show has been called.
- (self, steps=-1) - Shows the diagram calculating 'steps' generations
for dynamic diagrams (style TRAJECTORIES or PATCHES).
- (self, color) - Shows candidates(!) for fixed points (only if style
- (self) - Redraws the diagram.
- (self) - Takes notice of a resized graphics context and redraws the