egttools.plotting.simplified.plot_pairwise_comparison_rule_dynamics_in_simplex

plot_pairwise_comparison_rule_dynamics_in_simplex(population_size, beta, payoff_matrix=None, game=None, group_size=2, atol=1e-07, figsize=(10, 8), ax=None, stability_mode='int')[source]

Plot dynamics of a finite population using the pairwise comparison rule on a 2D simplex.

This method visualizes the direction of selection under a discrete dynamics model for finite populations using pairwise comparison.

Parameters:
  • population_size (int) – Number of individuals in the population.

  • beta (float) – Selection strength parameter (0 = neutral drift).

  • payoff_matrix (Optional[NDArray[np.float64]], default=None) – Matrix of payoffs. If not provided, a game must be supplied.

  • game (Optional[AbstractGame], default=None) – A game object encoding payoff logic. Used if payoff_matrix is not given.

  • group_size (Optional[int], default=2) – Number of interacting players.

  • atol (float, default=1e-7) – Tolerance used to identify edges with random drift.

  • figsize (Tuple[int, int], default=(10, 8)) – Size of the figure, only used if ax is not provided.

  • ax (Optional[plt.Axes], default=None) – Matplotlib axis to plot on.

  • stability_mode ({'bool', 'int'}, default='int') – Whether to return boolean or ternary stability classification: - ‘bool’: True = stable, False = not stable - ‘int’: 1 = stable, 0 = saddle, -1 = unstable

Returns:

  • The Simplex2D plot object.

  • The selection gradient function for dynamics simulation.

  • List of equilibrium points in barycentric coordinates.

  • Same list in Cartesian coordinates.

  • List of stability indicators (bool or int).

  • The instantiated game object.

  • The evolver used for computing selection gradients.

Return type:

Tuple[Simplex2D, Callable, List[NDArray], List[NDArray], List[bool] or List[int], AbstractGame, PairwiseComparison]