Fix undefined ax variable in plot_results (#24345)
Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com>
This commit is contained in:
parent
222539f454
commit
89fc97e30f
@ -876,6 +876,7 @@ def plot_results(file: str = "path/to/results.csv", dir: str = "", on_plot: Call
|
||||
assert len(files), f"No results.csv files found in {save_dir.resolve()}, nothing to plot."
|
||||
|
||||
loss_keys, metric_keys = [], []
|
||||
fig, ax = None, None
|
||||
for i, f in enumerate(files):
|
||||
try:
|
||||
data = pl.read_csv(f, infer_schema_length=None)
|
||||
@ -899,12 +900,13 @@ def plot_results(file: str = "path/to/results.csv", dir: str = "", on_plot: Call
|
||||
ax[i].set_title(j, fontsize=12)
|
||||
except Exception as e:
|
||||
LOGGER.error(f"Plotting error for {f}: {e}")
|
||||
ax[1].legend()
|
||||
fname = save_dir / "results.png"
|
||||
fig.savefig(fname, dpi=200)
|
||||
plt.close()
|
||||
if on_plot:
|
||||
on_plot(fname)
|
||||
if ax is not None:
|
||||
ax[1].legend()
|
||||
fname = save_dir / "results.png"
|
||||
fig.savefig(fname, dpi=200)
|
||||
plt.close()
|
||||
if on_plot:
|
||||
on_plot(fname)
|
||||
|
||||
|
||||
def plt_color_scatter(v, f, bins: int = 20, cmap: str = "viridis", alpha: float = 0.8, edgecolors: str = "none"):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user