Closed 8me closed 5 months ago
Hi @8me thanks for the PR! I think I understand the change, but could you add a picture here just for posterity?
@andrzejnovak Here we go 😉 ... ok I created this example script:
#!/usr/bin/env python
# coding=utf-8
# Filename: test.py
"""
MPLHEP testplot script
"""
import mplhep
import numpy as np
import matplotlib.pyplot as plt
BINS = np.linspace(0, 1, 10)
def main():
samples = np.random.normal(loc=0.5, scale=0.1, size=1000)
wgts = np.random.rand(1000)
h = np.histogram(samples, bins=BINS, weights=wgts)
h2 = np.histogram(samples, bins=BINS, weights=wgts**2)
fig, ax = plt.subplots()
mplhep.histplot(h, w2=h2[0], linestyle=':', ax=ax, label="Test Hist")
ax.legend()
plt.savefig("new.pdf")
if __name__ == '__main__':
main()
So with the current master the legend for a histogram with linestyle=':'
looks like:
... with the changes on this PR it would look like:
Perfect, thanks for the PR!
The legend entries for
mplhep.histplot
forhisttype='step'
shows always continuous entires no matter whatlinestyle
arg is defined. In order to fix that the linestyle is forwarded to_e_leg
andxerr
is set toNone
as it is not used in the step mode.