From 6f2aa4425e7a62ae883223d2024195af2f4a55c5 Mon Sep 17 00:00:00 2001 From: erexer <13180883+erexer@users.noreply.github.com> Date: Fri, 12 Jul 2024 09:29:26 -0700 Subject: [PATCH] fix 2nd instance of colorbar --- msdbook/fishery_dynamics.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/msdbook/fishery_dynamics.py b/msdbook/fishery_dynamics.py index b509b3b..d86c803 100644 --- a/msdbook/fishery_dynamics.py +++ b/msdbook/fishery_dynamics.py @@ -190,7 +190,10 @@ def plot_factor_performance(param_values, collapse_days, b, m, a): # set up colorbar sm.set_array([collapse_days.min(), collapse_days.max()]) - cbar = fig.colorbar(sm) + cbar = plt.colorbar( + sm, + ax=plt.gca() + ) cbar.set_label('Days with predator collapse') return ax1, ax2