I was just playing with things, and it occurs to me that a lot of our "style" issues for 1D histograms might be solved by using bar plots with the widths parameter. If we want a line style, then we get vertical lines between the bars, but I could imagine this being solved with a new option to the matplotlib method that hides such lines, producing a sky-line effect. Was this already considered somewhere?
The bar chart with no gaps was, but not the new option to Matplotlib. I haven't considered this "just another way to draw a skyline" because the graphics primitives involved are very different. For a bar chart, you make many rectangles—which can be a performance problem if you have a thousand bins—but for a skyline you make a single polyline. It could be that we got used to this style because of the time it takes to draw on a line printer with PAW. (Imagine one of those pen-robot printers trying to draw a thousand rectangles!) Even if that was its origin, I still find the style cleaner and easier to read.
I have no objection to presenting it in the high-level interface as just another drawing option. In fact, that sounds like a good way to get that information from the user. But the implementation is quite different.
Yes, I was going to say, I appreciate that consideration but it feels very low level to me.
Does matplotlib already optimise such things under the hood bonnet ?
If two identical filled paths intersect, is it rendered via the union of such paths, for example?
make a notebook with an example in the repo?
It may be true that the skyline was once born out of a practical solution, but it also in agreement with Tufte's principle of maximizing the amount of data-ink to plot-ink. The additional lines in a bar plot do not add information, they are distracting.
In other words, Tufte's principle is this: if the plot conveys the same information when you remove a line, then you should remove that line.
What is a "skyline" plot? I have never heard of this term until I joined these gitter channels, but then again, I am not on an LHC experiment
Think the outline of a bar chart (i.e. no vertical bars between each bin) were the edges always go to zero
Jim posted some examples higher up in this chat (Feb 27 15:49)
Thanks. This would be the equivalent of histtype='step' in matplotlib.pyplot, right?
Yup though the best way to do it for a already binned histogram data is less obvious
Plotting pre-binned data in mpl is simple, but is only obvious in hindsight (I posted a solution to this in the PyHEP channel). I am personally not opinionated about whether using the weights argument for this purpose is good enough, but I use it regularly and have never had any problems with it
I should add this to the readme, but the goal here is to develop a strawman via 1) making a gallery of HEP examples in mpl; 2) find the minimal set of interface tools to make things eaiser and write a spec; 3) implement the spec in this package
@nsmith- copied from pyhep room: You're also collecting a list of proposed changes to mpl more generally, right? If so, I might ping our colleagues to see where they think the mpl shortcoming are. I'm not sure how informative it is for you, but I can screen share you through the Python code behind dark matter publications to get an idea of what people do. Only if it's educational/useful. Oh, wait, there is mpl-hep room... should talk there
I have tried rootpy and I think it has the issue that one needs to have ROOT installed, and know ROOT. This might not be an issue for experimentalists, but theoreticians typically do not interact much with root. But would have root/hepmc files generated by some MC generator or taken from experimentalists . The other issue with rootpy, is it treats root objects as ROOT objects, whilst it is favourable to have them as bumpy objects when some analysis is desired before plotting. uproot provides that and it is possible to plot histograms for example using packages like Pyik .
I would like to see some improvements in this direction. Like stacked histograms and TGCut..etc
Hi Lina, you should use uproot to read ROOT files. It works great and you don't need ROOT installed. For HepMC you can use pyhepmc from scikit-hep, search on github for scikit-hep and pyhepmc. In this channel we mostly talk about
Typical ROOT plots with matplotlib equivalents. The first step is to identify "typical" plots, like your 2d box plot.
This is now live and ported to scikit-het https://github.com/scikit-hep/mplhep I will continue adding functionality as needed, but it would be great if you would want to contribute new methods with examples :)
Do people have thoughts on changing the interface so that mplhep would directly modify the mpl pyplot and axis classes, so that one would no longer import both mplhep and matplotlib, but just do import mplhep.pyplot as plt which would work just like matplotlib .pyplot except it would include our histplot functions ?
If you do this by inheriting pyplot, why not. In my little toolset https://github.com/hdembinski/pyik, I just use pyplot internally in the plotting commands, which are free-standing functions.
Inheriting from pyplot seems a bit more elegant than this