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

[FEATURE] hist.plot legend automatically #558

Open
andrzejnovak opened this issue Jan 31, 2024 · 0 comments
Open

[FEATURE] hist.plot legend automatically #558

andrzejnovak opened this issue Jan 31, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@andrzejnovak
Copy link
Member

Currently running

h = hist.new.Reg(100, 0, 10, label="X").StrCat([], label="Sample", growth=True).Weight()\
        .fill(np.random.normal(5, 1, int(1e5)), np.random.choice(list("ABCDEF"), int(1e5)))
h.plot1d(stack=True, histtype='fill', sort='label');
plt.legend()
hep.cms.label();

doesn't automatically plot the legend, meaning that when user triggers this themselves the "Sample" label won't appear automatically because there is nowhere to store it within the plot1d method without calling legend.

image

Should we include the legend automatically so that the legend title can be read from the axis info? The downside the user having slightly worse access to the legend object compared to they themselves running leg = plt.legend()

@andrzejnovak andrzejnovak added the enhancement New feature or request label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant