aboutsummaryrefslogtreecommitdiff
path: root/utils/plot-root-results
diff options
context:
space:
mode:
Diffstat (limited to 'utils/plot-root-results')
-rwxr-xr-xutils/plot-root-results46
1 files changed, 5 insertions, 41 deletions
diff --git a/utils/plot-root-results b/utils/plot-root-results
index 7f115f1..51df7cc 100755
--- a/utils/plot-root-results
+++ b/utils/plot-root-results
@@ -22,52 +22,16 @@ if __name__ == '__main__':
import argparse
from os.path import split
from sddm.plot import despine
+ from sddm import setup_matplotlib
parser = argparse.ArgumentParser("plot ROOT fit results")
parser.add_argument("filename", help="input file")
parser.add_argument("--save", action="store_true", default=False, help="save plots")
args = parser.parse_args()
- if args.save:
- # default \textwidth for a fullpage article in Latex is 16.50764 cm.
- # You can figure this out by compiling the following TeX document:
- #
- # \documentclass{article}
- # \usepackage{fullpage}
- # \usepackage{layouts}
- # \begin{document}
- # textwidth in cm: \printinunitsof{cm}\prntlen{\textwidth}
- # \end{document}
-
- width = 16.50764
- width /= 2.54 # cm -> inches
- # According to this page:
- # http://www-personal.umich.edu/~jpboyd/eng403_chap2_tuftegospel.pdf,
- # Tufte suggests an aspect ratio of 1.5 - 1.6.
- height = width/1.5
- FIGSIZE = (width,height)
-
- import matplotlib.pyplot as plt
-
- font = {'family':'serif', 'serif': ['computer modern roman']}
- plt.rc('font',**font)
-
- plt.rc('text', usetex=True)
- else:
- # on retina screens, the default plots are way too small
- # by using Qt5 and setting QT_AUTO_SCREEN_SCALE_FACTOR=1
- # Qt5 will scale everything using the dpi in ~/.Xresources
- import matplotlib
- matplotlib.use("Qt5Agg")
-
- import matplotlib.pyplot as plt
-
- # Default figure size. Currently set to my monitor width and height so that
- # things are properly formatted
- FIGSIZE = (13.78,7.48)
+ setup_matplotlib(args.save)
- # Make the defalt font bigger
- plt.rc('font', size=22)
+ import matplotlib.pyplot as plt
root_file = ROOT.TFile(args.filename)
@@ -99,7 +63,7 @@ if __name__ == '__main__':
hist /= norm
- fig = plt.figure(figsize=FIGSIZE)
+ fig = plt.figure()
plt.hist(bincenters,weights=hist,bins=bins,histtype='step')
x = np.linspace(bins[0],bins[-1],10000)
if tf1_number:
@@ -154,7 +118,7 @@ if __name__ == '__main__':
y = np.array(y)
yerr = np.array(yerr)
- fig = plt.figure(figsize=FIGSIZE)
+ fig = plt.figure()
plt.errorbar(x,y,yerr=yerr,fmt='o')
x = np.linspace(x[0],x[-1],10000)
if tf1_number: