Skip to content

Commit 3c2569a

Browse files
committed
Python: proper handling of clear figure
1 parent 6bccb0b commit 3c2569a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Utilities/Python/fdsplotlib.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,22 +2022,22 @@ def scatplot(saved_data, drange, **kwargs):
20222022

20232023
for _, row in Q.iterrows():
20242024
plt.close('all')
2025-
plt.figure().clear()
2025+
plt.clf()
20262026

20272027
Scatter_Plot_Title = row["Scatter_Plot_Title"]
20282028
Plot_Filename = row["Plot_Filename"]
20292029
Plot_Min = float(row["Plot_Min"])
20302030
Plot_Max = float(row["Plot_Max"])
20312031
Plot_Type = str(row["Plot_Type"]).strip().lower()
20322032

2033-
# --- MATLAB parity: Sigma_E only required for Validation ---
2033+
# --- Sigma_E only required for Validation ---
20342034
if Stats_Output.lower() == "validation":
20352035
Sigma_E_input = float(row["Sigma_E"]) if "Sigma_E" in row and not pd.isna(row["Sigma_E"]) else 0.0
20362036
else:
20372037
Sigma_E_input = 0.0
20382038

2039-
#if verbose:
2040-
# print(f"[scatplot] Processing {Scatter_Plot_Title}")
2039+
if verbose:
2040+
print(f"[scatplot] Processing {Scatter_Plot_Title}")
20412041

20422042
# Match dataplot entries
20432043
match_idx = [i for i, q in enumerate(Save_Quantity)
@@ -2276,7 +2276,7 @@ def _label_at(k, labels):
22762276
os.makedirs(os.path.dirname(pdf_path), exist_ok=True)
22772277
fig.savefig(pdf_path)
22782278
plt.close(fig)
2279-
plt.figure().clear()
2279+
plt.clf()
22802280

22812281
# --- Collect statistics for CSV/TeX ---
22822282
group_labels = []
@@ -2608,7 +2608,7 @@ def statistics_histogram(Measured_Values, Predicted_Values,
26082608
plt.tight_layout()
26092609
fig.savefig(outpath)
26102610
plt.close(fig)
2611-
plt.figure().clear()
2611+
plt.clf()
26122612

26132613
return f"{os.path.basename(Plot_Filename)}_Histogram"
26142614

0 commit comments

Comments
 (0)