PyPlotter - A Python/Jython Graph Plotting Package. Manual

Eckhart Arnold

1 Introduction
2 License
3 Screenshots
4 Quick Tutorial
5 Reference
    5.1 Overview
    5.2 Class Graph.Cartesian
    5.3 Class Simplex.Diagram
6 Implementing a new device driver for PyPlotter

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.

__init__
(self, gfx, function, title=”Simplex Diagram”,
p1=”A”, p2=”B”, p3=”C”, styleFlags = VECTORS,
raster = RASTER_DEFAULT, density = -1,
color1 = (0.,1.,0.), color2 = (1.,0.,0.),
color3 = (0.,0.,1.), colorFunc = scaleColor,
titlePen = Gfx.BLACK_PEN, labelPen = Gfx.BLACK_PEN,
simplexPen=Gfx.BLACK_PEN, backgroundPen=Gfx.WHITE_PEN,
section=Graph.REGION_FULLSCREEN)

Initializes the class with the following parameters:
gfx
Gfx.Driver: The Gfx drivers used for drawing the simplex diagram.
 
function
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 with.
 
styleFlags
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 diagram.
 
raster
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.
 
density
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.
 
colorFunc
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 diagrams.
 
titlePen, labelPen, simplexPen, backgroundPen
Gfx.Pen: Pens for the respective parts of the simplex diagram.
 
section
4-tuple of floats from then range [0.0, 1.0]: the part of the screen to be used for the diagram.

 
setStyle
(self, styleFlags=None, titlePen=None,
labelPen=None, simplexPen=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.
 
setFunction
(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.
 
setRaster
(self, raster) - Changes the raster of sample points. The change will only be visible after the method show has been called.
 
setDensity
(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.
 
changeColors
(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.
 
show
(self, steps=-1) - Shows the diagram calculating 'steps' generations for dynamic diagrams (style TRAJECTORIES or PATCHES).
 
showFixedPoints
(self, color) - Shows candidates(!) for fixed points (only if style is PATCHES).
 
redraw
(self) - Redraws the diagram.
 
resizedGfx
(self) - Takes notice of a resized graphics context and redraws the diagram.

t g+ f @