Skip to content

Commit

Permalink
more parameters in eval plots
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawith committed Oct 21, 2025
1 parent ebf8fed commit 4779324
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions visualize/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
import matplotlib.pyplot as plt
import seaborn as sns

def lineplot(data=None, x=None, y=None):
def lineplot(data=None, x=None, y=None, hue=None):
if data is None or x is None or y is None:
raise ValueError("Data, x, and y parameters must be provided.")

sns.lineplot(data=data, x=x, y=y)
plt.title(f"{y} by {x}")
sns.lineplot(data=data, x=x, y=y, hue=hue)
plt.xlabel(x)
plt.ylabel(y)
plt.savefig(f"/app/workdir/figures/lineplot_{y}_by_{x}.png")
plt.legend()
if hue is not None:
plt.title(f"{y} by {x} and {hue}")
plt.savefig(f"/app/workdir/figures/lineplot_{y}_by_{x}_{hue}.png")
else:
plt.title(f"{y} by {x}")
plt.savefig(f"/app/workdir/figures/lineplot_{y}_by_{x}.png")
plt.close()


Expand Down

0 comments on commit 4779324

Please sign in to comment.