Skip to content

Commit

Permalink
title as part of legend
Browse files Browse the repository at this point in the history
  • Loading branch information
theoheimel committed Apr 5, 2023
1 parent 07c97d6 commit 14ef860
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ def plot_single_loss(
ax.plot(epochs, curve, label=label)
ax.set_xlabel("epoch")
ax.set_ylabel(ylabel)
self.corner_text(ax, self.title, "right", "top")
ax.set_yscale(yscale)
if any(label is not None for label in labels):
ax.legend(loc="center right", frameon=False)
ax.legend(loc="best", frameon=False, title=self.title)
else:
self.corner_text(ax, self.title, "right", "top")
plt.savefig(pdf, format="pdf", bbox_inches="tight")
plt.close()

Expand Down Expand Up @@ -309,7 +310,7 @@ def plot_single_weight_hist(
label = self.labels_w_hist[2],
color = self.colors[2]
)
self.corner_text(ax, self.title, "right", "top")
#self.corner_text(ax, self.title, "right", "top")
ax.set_xlabel("$w(x)$")
ax.set_ylabel("a.u.")
if xscale == 'symlog':
Expand All @@ -333,7 +334,7 @@ def Dtow(x):

if yscale == "linear":
ax.set_ylim(bottom=0)
ax.legend(frameon=False)
ax.legend(frameon=False, title=self.title)
plt.savefig(pdf, format="pdf", bbox_inches="tight")
plt.close()

Expand Down Expand Up @@ -621,10 +622,10 @@ def hist_plot(
ratio[ratio_isnan] = 1.
self.hist_line(ax, bins, ratio, ratio_err, label=None, color=line.color)

axs[0].legend(frameon=False)
axs[0].legend(frameon=False, title=self.title)
axs[0].set_ylabel("normalized")
axs[0].set_yscale(observable.yscale)
self.corner_text(axs[0], self.title, "right", "top")
#self.corner_text(axs[0], self.title, "right", "top")

if show_ratios:
axs[1].set_ylabel(r"$\frac{\mathrm{Model}}{\mathrm{Truth}}$")
Expand Down

0 comments on commit 14ef860

Please sign in to comment.