egttools.plotting.simplex3d

3D simplex (tetrahedron) visualisation using Plotly.

The 3D simplex represents a 4-strategy evolutionary game: every point (b0, b1, b2, b3) with bi ≥ 0, Σbi = 1 is a population state.

The key idea for interior visualisation is slicing: fix one strategy at a constant value c (e.g. b0 = c) and show the resulting triangular cross-section with the replicator dynamics projected onto it. Multiple slices at different levels of the same (or different) strategies build up an intuition of the interior flow.

Arrows are rendered as Plotly go.Cone glyphs — true 3D cones with correct WebGL depth sorting, so occlusion is handled automatically.

Coordinate convention

Strategy indices 0-3 map to the four vertices of a regular tetrahedron embedded in ℝ³:

V = np.array([
    [0,          0,                   0      ],   # strategy 0  (bottom-left)
    [1,          0,                   0      ],   # strategy 1  (bottom-right)
    [0.5,        np.sqrt(3)/2,        0      ],   # strategy 2  (bottom-back)
    [0.5,        np.sqrt(3)/6,        np.sqrt(6)/3],  # strategy 3 (top)
])

A barycentric point b is mapped to 3D via xyz = b @ V. A replicator velocity db/dt maps to 3D via dxyz/dt = (db/dt) @ V.

Functions

barycentric_to_cartesian

Convert barycentric coordinates to 3D Cartesian.

gradient_to_cartesian

Project a replicator-dynamics velocity vector from Δ³ to ℝ³.

Classes

Simplex3D

3D simplex (tetrahedron) visualisation for 4-strategy evolutionary games.