Skip to content

Commit 79348c2

Browse files
committed
Clear reused Matplotlib figures
1 parent 1e629fc commit 79348c2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

bioptim/gui/check_conditioning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def create_conditioning_plots(ocp):
128128
objectives_hess_func = hessian_objective(variables_vector, all_objectives)
129129

130130
# PLOT CONSTRAINTS
131-
fig_constraints, axis_constraints = plt.subplots(1, 2, num="Check conditioning for constraints")
131+
fig_constraints, axis_constraints = plt.subplots(1, 2, num="Check conditioning for constraints", clear=True)
132132

133133
# Jacobian plot
134134
fake_jacobian = np.zeros((nb_constraints, nb_variables))
@@ -161,7 +161,7 @@ def create_conditioning_plots(ocp):
161161
pass
162162

163163
# PLOT OBJECTIVES
164-
fig_obj, axis_obj = plt.subplots(1, 1, num="Check conditioning for objectives")
164+
fig_obj, axis_obj = plt.subplots(1, 1, num="Check conditioning for objectives", clear=True)
165165

166166
# Hessian objective plot
167167
fake_hessian_obj = np.zeros((nb_variables, nb_variables))

bioptim/gui/ipopt_output_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def create_ipopt_output_plot(ocp, interface):
1111
"""
1212
This function creates the plots for the ipopt output: f, g, inf_pr, inf_du.
1313
"""
14-
ipopt_fig, axs = plt.subplots(3, 1, num="IPOPT output")
14+
ipopt_fig, axs = plt.subplots(3, 1, num="IPOPT output", clear=True)
1515
axs[0].set_ylabel("f", fontweight="bold")
1616
axs[1].set_ylabel("inf_pr", fontweight="bold")
1717
axs[2].set_ylabel("inf_du", fontweight="bold")

0 commit comments

Comments
 (0)