From 00e3445484ab08be66320e82eef3fb1aa0b82223 Mon Sep 17 00:00:00 2001 From: Scott Sibole Date: Wed, 8 Jul 2026 09:48:11 -0700 Subject: [PATCH] get_cmap is a function of matplotlib.pyplot since version 3.8.0. Fixed for this change and matplotlib>=3.8.0 pinned --- bioptim/gui/check_conditioning.py | 5 ++--- bioptim/gui/ipopt_output_plot.py | 3 +-- environment.yml | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/bioptim/gui/check_conditioning.py b/bioptim/gui/check_conditioning.py index b2aec6985..8260a1dad 100644 --- a/bioptim/gui/check_conditioning.py +++ b/bioptim/gui/check_conditioning.py @@ -2,7 +2,6 @@ from casadi import Function, jacobian, hessian, sum1 from matplotlib import pyplot as plt import matplotlib.colors as mcolors -import matplotlib.cm as mcm from ..interfaces.ipopt_interface import IpoptInterface @@ -116,7 +115,7 @@ def evaluate_hessian_objective(v, ocp): def create_conditioning_plots(ocp): - cmap = mcm.get_cmap("seismic") + cmap = plt.get_cmap("seismic") cmap.set_bad(color="k") interface = IpoptInterface(ocp) variables_vector = ocp.variables_vector @@ -231,7 +230,7 @@ def update_objective_plot(v, ocp): hessian_matrix, condition_number, convexity = evaluate_hessian_objective(v, ocp) axis_obj = ocp.conditioning_plots["axis_obj"] im_objectives_hessian = ocp.conditioning_plots["im_objectives_hessian"] - cmap = mcm.get_cmap("seismic") + cmap = plt.get_cmap("seismic") # Hessian objective plot hess_min = np.min(hessian_matrix) if hessian_matrix.shape[0] != 0 else 0 diff --git a/bioptim/gui/ipopt_output_plot.py b/bioptim/gui/ipopt_output_plot.py index 25b15b3ca..bed0cc058 100644 --- a/bioptim/gui/ipopt_output_plot.py +++ b/bioptim/gui/ipopt_output_plot.py @@ -3,7 +3,6 @@ import numpy as np from casadi import jacobian, gradient, sum1, Function from matplotlib import pyplot as plt -from matplotlib.cm import get_cmap from ..misc.parameters_types import Str, Int @@ -18,7 +17,7 @@ def create_ipopt_output_plot(ocp, interface): axs[2].set_ylabel("inf_du", fontweight="bold") plots = [] - colors = get_cmap("viridis") + colors = plt.get_cmap("viridis") for i in range(3): plot = axs[i].plot([0], [1], linestyle="-", marker=".", color="k") plots.append(plot[0]) diff --git a/environment.yml b/environment.yml index 4636177dd..ef651eb28 100644 --- a/environment.yml +++ b/environment.yml @@ -5,7 +5,7 @@ channels: dependencies: - python >=3.10 - biorbd >=1.12,<1.13 -- matplotlib +- matplotlib >= 3.8.0 - pyqt - pyqtgraph - python-graphviz