egttools.plotting.network_plots.plot_parameter_sweep¶
- plot_parameter_sweep(cooperation_matrix, x_values, y_values, xlabel='Parameter X', ylabel='Parameter Y', title='Cooperation level', cmap='RdBu_r', vmin=0.0, vmax=1.0, ax=None, colorbar=True)[source]¶
Plot a 2-D parameter sweep as a heatmap.
- Parameters:
cooperation_matrix (
ndarray) – Mean cooperation level (or any scalar metric) for each parameter combination. Rows correspond toy_values, columns tox_values.xlabel (
str)ylabel (
str)title (
str)cmap (
str) – Matplotlib colormap name.vmin (
float) – Colour scale limits.vmax (
float) – Colour scale limits.ax (
Optional[Axes])colorbar (
bool)
- Return type:
Axes
Example
>>> import numpy as np >>> betas = np.linspace(0, 5, 20) >>> rewire_probs = np.linspace(0, 1, 20) >>> coop = np.zeros((len(rewire_probs), len(betas))) >>> # ... fill coop via nested loops calling estimate_strategy_distribution ... >>> plot_parameter_sweep(coop, betas, rewire_probs, ... xlabel="beta", ylabel="rewiring probability")