radn-dev/xmetrics/render_hist.py
2025-05-31 22:25:13 +00:00

33 lines
981 B
Python

import os
import pickle
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
plt.rcParams["figure.figsize"] = [18, 9]
plt.style.use("dark_background")
plt.subplots_adjust(left=0.05, right=0.99, top=0.95, bottom=0.05)
plt.margins(x=0.025)
plt.gca().xaxis.set_major_locator(MaxNLocator(integer=True))
with open("Y.dat", "rb") as file:
Y = pickle.load(file)
with open("X.dat", "rb") as file:
X = pickle.load(file)
with open("C.dat", "rb") as file:
C = pickle.load(file)
if os.getenv("SAME_UNITS"):
color = (0.5, 0.5, 0.5, 0.5)
plt.axline((0, 0), slope=1.0, linestyle="--", color=color, zorder=-10)
plt.axline((0, 0), slope=0.75, linestyle="--", color=color, zorder=-10)
plt.axline((0, 0), slope=0.5, linestyle="--", color=color, zorder=-10)
plt.axline((0, 0), slope=0.25, linestyle="--", color=color, zorder=-10)
plt.stackplot(
X,
Y,
colors=C,
aa=False,
linewidth=0.0,
)
plt.savefig("/code/metrics/out.png")