Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: compatibility with mplhep #177

Open
wants to merge 21 commits into
base: mpldev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/1d_func/1d_fct_stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def g(x):
range=[-10, 10],
ax=ax,
labels=["f1", "f2"],
stacked=True,
stack=True,
)

ax.set_xlabel("x")
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/1d_hist/1d_elt1_stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
ax=ax2,
edgecolor="black",
linewidth=0.5,
histtype="stepfilled",
stacked=True,
histtype="fill",
stack=True,
)

ax2.set_xlabel(name)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/1d_hist/1d_side_by_side.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
fig, ax = plt.subplots()

# Use a specificity of matplotlib: when a list of histograms is given, it will plot them side by side unless stacked=True or histtype is a "step" type.
plot_hist(histos, ax=ax, label=labels)
plot_hist(histos, ax=ax, histtype="side", label=labels)

# Set the x-ticks to the middle of the bins and label them
ax.set_xlim(0, len(categories))
Expand Down
8 changes: 2 additions & 6 deletions docs/examples/advanced/1d_comparison_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@
plot_hist(h1, label="Train A", ax=ax_main, histtype="step", linewidth=1.2, density=True)
plot_hist(h3, label="Train B", ax=ax_main, histtype="step", linewidth=1.2, density=True)
# And then, to make the plot easier to read, we redraw them with stepfilled, which add color below the line
plot_hist(
h1, ax=ax_main, histtype="stepfilled", color=colors[0], alpha=0.2, density=True
)
plot_hist(
h3, ax=ax_main, histtype="stepfilled", color=colors[1], alpha=0.2, density=True
)
plot_hist(h1, ax=ax_main, histtype="fill", color=colors[0], alpha=0.2, density=True)
plot_hist(h3, ax=ax_main, histtype="fill", color=colors[1], alpha=0.2, density=True)

# We plot 2 additional histograms with point style
plot_error_hist(h2, label="Test A", ax=ax_main, color="blue", density=True)
Expand Down
7 changes: 5 additions & 2 deletions docs/examples/advanced/1d_side_by_side_with_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@
# Plot the histogram
fig, ax = plt.subplots()

bin_width = 0.8

# Use a specificity of matplotlib: when a list of histograms is given, it will plot them side by side unless stacked=True or histtype is a "step" type.
plot_hist(histos, ax=ax, label=labels, color=colors)
plot_hist(
histos, ax=ax, histtype="side", label=labels, color=colors, bin_width=bin_width
)


# Add the number of entries on top of each bar
Expand All @@ -49,7 +53,6 @@ def calculate_shifts(width, n_bars):
return shift


bin_width = 0.8
shift = calculate_shifts(bin_width, len(histos))

# Loop over the histograms, add on top of each bar the number of entries
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/advanced/asymmetry_comparison_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def f2(x):
"markeredgecolor": "tab:red",
"ls": "None",
"fmt": "o",
"markersize": 5,
"markersize": 10,
"label": "$Data_1$",
}

Expand All @@ -65,7 +65,7 @@ def f2(x):
"markeredgecolor": "tab:blue",
"ls": "None",
"fmt": "o",
"markersize": 5,
"markersize": 10,
"label": "$Data_2$",
}

Expand Down
Loading