From dfb4b3bd0f49cae8d1563c1f1adf022f33822495 Mon Sep 17 00:00:00 2001 From: Annika Vauth <annika.vauth@desy.de> Date: Wed, 19 Jul 2023 17:13:11 +0200 Subject: [PATCH] different way to plot the result in the example code --- Example.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Example.py b/Example.py index 3662172..69f0d7c 100644 --- a/Example.py +++ b/Example.py @@ -1,6 +1,6 @@ from LightSimtastic import SiPMSimulation import matplotlib.pyplot as plt - +import numpy as np ################################# # THE SIMULATION TOOL TAKES A DICTIONARY AS AN INPUT, WITH EACH OF THE VARIABLES AS KEYS. @@ -80,14 +80,14 @@ Qs = df.iloc[0]["ChargeSpectrum"] # PLOT ################################# - - plt.figure(figsize=(15.5,10.5)) -plt.hist(Qs, label="Simulated Charge Spectrum", bins=1000) +H, edges = np.histogram(Qs, bins=1000) +edges = edges[:-1]+(edges[1]-edges[0]) +plt.plot(edges, H) +plt.title("Simulated Charge Spectrum") plt.yscale("log") plt.xticks(fontsize=25) plt.yticks(fontsize=25) plt.xlabel("# GD", fontsize=25), plt.savefig("./Example.png") -plt.legend(fontsize=25) -- GitLab