|
9 | 9 |
|
10 | 10 | df = get_dummy_data() |
11 | 11 |
|
12 | | -from mplhep import get_color_palette |
| 12 | +import seaborn as sns |
13 | 13 |
|
14 | 14 | # Define the histograms |
15 | 15 |
|
|
23 | 23 |
|
24 | 24 | background_categories = [0, 1, 2] |
25 | 25 | background_categories_labels = [f"c{i}" for i in background_categories] |
26 | | -background_categories_colors = get_color_palette( |
| 26 | +background_categories_colors = sns.color_palette( |
27 | 27 | "cubehelix", len(background_categories) |
28 | 28 | ) |
29 | 29 |
|
|
52 | 52 | background_hists = [background_scaling_factor * h for h in background_hists] |
53 | 53 |
|
54 | 54 | ### |
| 55 | +import matplotlib.pyplot as plt |
55 | 56 | import numpy as np |
56 | 57 |
|
57 | 58 | from mplhep import ( |
58 | 59 | add_text, |
59 | | - create_comparison_figure, |
60 | 60 | plot_comparison, |
61 | 61 | plot_data_model_comparison, |
62 | 62 | set_fitting_ylabel_fontsize, |
63 | 63 | ) |
64 | 64 |
|
65 | | -fig, axes = create_comparison_figure( |
66 | | - figsize=(6, 13), |
| 65 | +fig, axes = plt.subplots( |
67 | 66 | nrows=6, |
| 67 | + figsize=(6, 13), |
68 | 68 | gridspec_kw={"height_ratios": [3, 1, 1, 1, 1, 1]}, |
69 | | - hspace=0.3, |
70 | 69 | ) |
| 70 | +fig.subplots_adjust(hspace=0.3) |
| 71 | +for ax in axes[:-1]: |
| 72 | + ax.xaxis.set_ticklabels([]) |
| 73 | + ax.set_xlabel(" ") |
71 | 74 | background_sum = sum(background_hists) |
72 | 75 |
|
73 | 76 | plot_data_model_comparison( |
|
87 | 90 | add_text( |
88 | 91 | r"Multiple data-model comparisons, $\mathbf{without}$ model uncertainty", |
89 | 92 | ax=axes[0], |
| 93 | + loc="over left", |
| 94 | + fontsize="small", |
| 95 | +) |
| 96 | +add_text( |
| 97 | + r' $\mathbf{→}$ comparison = "ratio"', ax=axes[1], loc="over left", fontsize=13 |
90 | 98 | ) |
91 | | -add_text(r' $\mathbf{→}$ comparison = "ratio"', ax=axes[1], fontsize=13) |
92 | 99 |
|
93 | 100 | for k_comp, comparison in enumerate( |
94 | 101 | ["split_ratio", "pull", "relative_difference", "difference"], start=2 |
|
117 | 124 | add_text( |
118 | 125 | rf' $\mathbf{{→}}$ comparison = "{comparison}"', |
119 | 126 | ax=ax_comparison, |
| 127 | + loc="over left", |
120 | 128 | fontsize=13, |
121 | 129 | ) |
122 | 130 | set_fitting_ylabel_fontsize(ax_comparison) |
|
0 commit comments