18 def histplot(data_x, data_y, error=None, label=None, **kwargs):
20 "xlabel" :
r"$p_T\:[GeV]$",
21 "ylabel":
'Efficiency',
23 "title1_1":
r"Simulation",
24 "title2":
r"$\sqrt{s}=13\:TeV$",
25 "filename":
"trunontest",
30 "errorbar_limit":
None,
32 for each_key
in kwargs.items():
33 settings[each_key[0]] = kwargs[each_key[0]]
34 plt.figure(figsize=(8, 6))
38 label = [
"a"] * len(data_x)
39 for i
in range(len(data_x)):
41 if settings[
"errorbar_limit"]
is not None:
43 for each_error, each_yi
in zip(error[i], data_y[i]):
45 if each_yi + each_error > settings[
"errorbar_limit"]:
46 uperror = settings[
"errorbar_limit"] - each_yi
47 allerror.append([each_error, uperror])
53 plt.errorbar(data_x[i], data_y[i], yerr=np.array(allerror).T, label=label[i], fmt=style)
55 plt.plot(data_x[i], data_y[i], label=label[i])
58 plt.legend(loc=
'upper right', prop={
'size': 25}, frameon=
False)
62 ax1.set_ylim([0,
max([y
for x
in data_y
for y
in x])* settings[
"upper_y"]])
63 ax1.text(0.05, 1.55 / 1.7, settings[
'title1'], fontsize=25, transform=ax1.transAxes, style=
'italic', fontweight=
'bold')
64 ax1.text(0.28, 1.55/ 1.7, settings[
'title1_1'], fontsize=25, transform=ax1.transAxes)
65 ax1.text(0.05, 1.40 / 1.7, settings[
'title2'], fontsize=23, transform=ax1.transAxes)
67 plt.tick_params(labelsize=16)
68 plt.tick_params(labelsize=16)
69 plt.ylabel(settings[
'ylabel'], fontsize=20)
70 plt.xlabel(settings[
'xlabel'], fontsize=20)
71 plt.savefig(settings[
'filename'] +
'.pdf', bbox_inches=
'tight')