-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplotting.py
More file actions
45 lines (38 loc) · 1.07 KB
/
plotting.py
File metadata and controls
45 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""Define useful plot styles and utilities."""
import matplotlib.pyplot as plt
# import scienceplots # noqa: F401
#:plt.style.use(["science", "notebook"])
plt.rcParams["font.size"] = 14
plt.rcParams["axes.formatter.limits"] = -5, 4
plt.rcParams["figure.figsize"] = 6, 4
colors = plt.rcParams["axes.prop_cycle"].by_key()["color"]
def watermark(text="preliminary"):
"""Watermark plot."""
ax = plt.gca()
plt.text(
0.64,
1.02,
"SND@HL-LHC",
fontweight="bold",
fontfamily="sans-serif",
fontsize=16,
transform=ax.transAxes,
usetex=False,
)
plt.text(
0.0,
1.02,
text,
fontfamily="sans-serif",
fontsize=16,
transform=ax.transAxes,
usetex=False,
)
def plot_event(hitmaps, event=0):
"""Plot CNN image."""
plt.imshow(hitmaps[event], aspect=0.05)
plt.xlabel(r"$2 \times \text{Station} + \text{Plane}$")
plt.ylabel(r"Global strip index")
watermark()
plt.savefig(f"plots/hitmap_{event}.pdf")
plt.savefig(f"plots/hitmap_{event}.png")