egttools.plotting.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)[source]

Helper function to simplify the plotting of the moran dynamics in a 2 Simplex.

Parameters
  • population_size (int) – Size of the finite population.

  • beta (float) – Intensity of selection.

  • payoff_matrix (Optional[ndarray]) – The square payoff matrix. Group games are still unsupported in the replicator dynamics. This feature will soon be added.

  • game (Optional[AbstractGame]) – Game that should contain a set of payoff matrices

  • group_size (Optional[int]) – Size of the group. By default, we assume that interactions are pairwise (the group size is 2).

  • atol (Optional[float]) – Tolerance to consider a value equal to zero. This is used to check if an edge has random drift. By default the tolerance is 1e-7.

  • figsize (Optional[Tuple[int, int]]) – Size of the figure. This parameter is only used if the ax parameter is not defined.

  • ax (Optional[axis]) – A matplotlib figure axis.

Return type

Tuple[Simplex2D, Callable[[ndarray, int], ndarray], List[ndarray], List[ndarray], List[bool], AbstractGame, PairwiseComparison]

Returns

  • A tuple with the simplex object which can be used to add more features to the plot, the function that

  • can be used to calculate gradients and should be passed to Simplex2D.draw_trajectory_from_roots and

  • Simplex2D.draw_scatter_shadow, a list of the roots in barycentric coordinates, a list of the roots in

  • cartesian coordinates and a list of booleans indicating whether the roots are stable. It also returns the

  • game class (this is important, since a new game is created when passing a payoff matrix, and if not returned,

  • a reference to the game instance will disappear, and it will produce a segmentation fault). Finally, it also returns

  • a reference to the evolver object.