PyPlotter - A Python/Jython Graph Plotting Package. Manual
|4 Quick Tutorial|
|4.1 Example 1: Plotting a Graph|
|4.2 Example 2: Plotting a simplex diagram|
|6 Implementing a new device driver for PyPlotter|
Here is a short code snipplet to demonstrate the use of a simplex diagram. For the sake of brevity, the actual population dynamical function is not contained. See file “Example2.py” for the full program.
1: from PyPlotter import tkGfx as GfxDriver 2: from PyPlotter import Simplex 3: 4: gfx = GfxDriver.Window(title="Demand Game") 5: dynamicsFunction = lambda p: PopulationDynamics(p,DemandGame, 6: e=0.0,noise=0.0) 7: diagram = Simplex.Diagram(gfx, dynamicsFunction, "Demand Game", 8: "Demand 1/3", "Demand 2/3", "Demand 1/2") 9: diagram.show() 10: gfx.waitUntilClosed()
In order to draw a simplex diagram, you need to instantiate class Simplex.Diagram (line 7) with a suitable population dynamical function. Class Simplex.Diagram is specifically designed for visualizing population dynamics. If you want to use simplex diagrams for another purpose, you should use the lower level class Simplex.Plotter instead. The simplex diagram will not be drawn, unless the show method of class Simplex.Diagram is called, as it is done in line 9 of this example.