Skip to content

Commit 10fb30c

Browse files
authored
Merge pull request #1059 from siboles/master
get_cmap is a function of matplotlib.pyplot since version 3.8.0
2 parents a5f8133 + 00e3445 commit 10fb30c

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

bioptim/gui/check_conditioning.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from casadi import Function, jacobian, hessian, sum1
33
from matplotlib import pyplot as plt
44
import matplotlib.colors as mcolors
5-
import matplotlib.cm as mcm
65
from ..interfaces.ipopt_interface import IpoptInterface
76

87

@@ -116,7 +115,7 @@ def evaluate_hessian_objective(v, ocp):
116115

117116
def create_conditioning_plots(ocp):
118117

119-
cmap = mcm.get_cmap("seismic")
118+
cmap = plt.get_cmap("seismic")
120119
cmap.set_bad(color="k")
121120
interface = IpoptInterface(ocp)
122121
variables_vector = ocp.variables_vector
@@ -231,7 +230,7 @@ def update_objective_plot(v, ocp):
231230
hessian_matrix, condition_number, convexity = evaluate_hessian_objective(v, ocp)
232231
axis_obj = ocp.conditioning_plots["axis_obj"]
233232
im_objectives_hessian = ocp.conditioning_plots["im_objectives_hessian"]
234-
cmap = mcm.get_cmap("seismic")
233+
cmap = plt.get_cmap("seismic")
235234

236235
# Hessian objective plot
237236
hess_min = np.min(hessian_matrix) if hessian_matrix.shape[0] != 0 else 0

bioptim/gui/ipopt_output_plot.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import numpy as np
44
from casadi import jacobian, gradient, sum1, Function
55
from matplotlib import pyplot as plt
6-
from matplotlib.cm import get_cmap
76

87
from ..misc.parameters_types import Str, Int
98

@@ -18,7 +17,7 @@ def create_ipopt_output_plot(ocp, interface):
1817
axs[2].set_ylabel("inf_du", fontweight="bold")
1918

2019
plots = []
21-
colors = get_cmap("viridis")
20+
colors = plt.get_cmap("viridis")
2221
for i in range(3):
2322
plot = axs[i].plot([0], [1], linestyle="-", marker=".", color="k")
2423
plots.append(plot[0])

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
dependencies:
66
- python >=3.10
77
- biorbd >=1.12,<1.13
8-
- matplotlib
8+
- matplotlib >= 3.8.0
99
- pyqt
1010
- pyqtgraph
1111
- python-graphviz

0 commit comments

Comments
 (0)