-
Notifications
You must be signed in to change notification settings - Fork 66
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
Wrong default display for mplhep.histplot #98
Comments
I agree with this - what is "default" now is not what we in HEP take it as default. The whole point of mplhep is to provide a simple, handy and HEP-like interface atop matplotlib, right? @andrzejnovak, shall we try and take in community input to improve the package? You should feel more than free to discuss APIs and anything relevant on the Gitter channel, to converge at best. To me this suggestion makes sense and should be taken on board asap. Thanks. |
@HDembinski I am not 100% sure what you mean about the markers. Re edges, there was a discussion somewhere in matplotlib/matplotlib#6669, https://docs.google.com/document/d/1ju3JObrPEyT7QpCx3m1YoVp0gFbLay8ZIxtO0mUCvgo/edit# and the gitter about this and one point that resonated with me is that drawing the edges seems to make a statement about the distribution end which is usually not the case. I'm open to changing it but would like a better reason than that's how ROOT does it. |
Apologies for chiming in again. In the end the edges are just reflecting the binning structure and the contents per bin, no? So, once you make a binned plot the edges just fall to zero if no entries are in the bin(s) after. Seems natural to me. Nothing to do with what ROOT does ;-). |
From matplotlib/matplotlib#6669
In the proposed setup the edge does not bring additional information to the plot, but if you interpret it as such it can send the wrong message. |
Full agreement with Eduardo. Also, when you fill the histogram with solid color, you also see the first and last edge. The natural expectation is that a non-filled histogram shows the outline of the filled region, hence also the first and last edge. |
On your posting
Hans's comment on filled histograms are ever more clear/strong. |
Feel free to bring in others to the conversation, BTW ... |
Copying my comment from the IRIS-HEP Slack, histograms are really outlines of a bar plot, we just generally remove the inner lines for clarity. Removing the outer lines does not work, it ruins the outline. |
@HDembinski you must be doing something to your rcParams. The whole plot looks neither like the mpl default or any of the mplhep styles. Otherwise the markers (not usually visible) are a result of the the implementation of the underlying mpl function. I could probably force set them in the function, but that's not great. |
Can I recommend a few example notebooks, integrated into docs using nbsphinx, that are run automatically? It would be great for seeing examples of what the plots and styles look like. @andrzejnovak I can help you set it up if you want me do. See Boost-histogram's example section. |
There's also JupyterBook, if you don't plan to have Sphinx for any of the other docs. Example (not mine): https://cranmer.github.io/madminer-tutorial/intro |
@henryiii Auto built docs are on the to do, but it was taking me longer than i thought |
Unless the markers get drawn at every corner (Mickey-mouse style), they really are not even correct and would probably not ever be useful and could be forced off, I would think. |
As i said, i am willing to change default, but i am surprised how strongly people feel about this, given it's entirely cosmetic and doesn't carry any more information than without edges. I do suspect this is more than anything to do with just being used to it looking the way it does in ROOT. |
JuptyerBooks are really easy (I converted this class in a couple of hours of meetings), though I haven't built one into GHA yet (on my do list), I can send you a ping whenever I do that if you think that is a way you might want to go. If you are interested in the Sphinx route, then boost-histogram is an example that might be useful (I have auto building off there, since the C++ parts are not built on ReadTheDocs). |
@andrzejnovak I am not doing anything special in my rcParams, and anyway, the markers should never be drawn whatever I have in my rcParams. |
Fair enough, I can't imagine a use case where one would actually want to show those markers, so I think we can hard-code it. |
The command
hep.histplot(h, bins, ax=axs[0])
does not produce a histogram in HEP-style. It draws markers at the edges, which is wrong, and the lines of the histogram do not go down to zero.
hep.histplot(h, bins, edges=True, ax=axs[1])
is closer to the expected skyline, but the markers are still wrong. Apart from the wrong markers, this should be the default. In fact, I cannot imagine that one ever wants to have
edges=False
.The text was updated successfully, but these errors were encountered: