Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jim Pivarski
    @jpivarski
    Some of the important issues include
    1. plotting pre-histogrammed data, supplying only the bin contents;
    2. handling log scales gracefully, considering that some bins may be 0 (unfilled) or negative (due to the negative weights we frequently use, a bin can fluctuate down);
    3. the "skyline" visual rendering that's conventional in our field;
    4. error bars and details of the error bar rendering (e.g. do we need caps at the ends?);
    5. common plot types in our field: stacked simulations, data with error bars, difference between the stacked simulation and the data in an aligned window, overlaid fits, confidence bands, upper limit plots, etc.;
    6. common and Pythonic data formats to deliver such data to Matplotlib: e.g. do we want to extend Numpy's 2-tuple (bin contents and axis edges) to include more information in subsequent tuple indexes? If so, can we standardize a format?
    rootpy (http://www.rootpy.org/auto_examples/plotting/plot_matplotlib_hist.html) is one example of a library that makes Matplotlib behave as we want; link others here.
    benkrikler
    @benkrikler
    7 (or possibly a subpoint of 1.) correctly show boundaries of outermost bins in a step plot or fill-between with steps. Currently most work-arounds add an extra bin at either end filled with 0 (or some other sensible value).
    Jim Pivarski
    @jpivarski
    Yes, like this: Note the drop toward zero at the left and right edges and between zero and non-zero bins, even in log scale.
    Low statistics:
    Hans Dembinski
    @HDembinski
    I just invited Thomas from Matplotlib over, using the matplotlib issue. Other people may also join, since this was a public invitation.
    The google doc is excellent, I forgot we had that
    Henry Schreiner
    @henryiii
    Would anyone be interested in presenting the plans for mpl-hep at an IRIS-HEP meeting around the end of March or early April? I would like to present boost-histogram and hist work & plans, and that would be of similar interest.
    Nicholas Smith
    @nsmith-
    I would be willing to
    I have on my to-do list to start a repository to collect some of the work done so far (mpl idioms)
    Henry Schreiner
    @henryiii
    @nsmith- That’s great! Would Mon, 15 Apr at 17:30 CERN work for you?
    Nicholas Smith
    @nsmith-
    I believe so, although I have regular meetings starting at 16h and 18h30, so it might be a talk and run situation
    Henry Schreiner
    @henryiii
    Thanks @nsmith- !
    Pieter David
    @pieterdavid
    Hi, just in case you find anything useful in it: I wrote https://github.com/pieterdavid/mplbplot to make the plots in my thesis (and LHCb-PAPER-2016-065) with matplotlib from ROOT histograms and graphs (I knew about rootpy, but we already had the pyroot code, so I wanted something more limited in scope to just get the data points and plot them).
    Nicholas Smith
    @nsmith-
    hi guys, I made a skeleton at https://github.com/nsmith-/mpl-hep and want to invite people as collaborators to the repository. Let me know if you want in on it. The idea would be to start by compiling a wishlist of what kind of plot styles we want to support, inside the binder/gallery.ipynb notebook that is also accessible through binder. Feel free to edit and merge the notebooks (although this could get messy..) Then we can take that and make a specification, then start to write an actual python library based on that. Thoughts?
    Tai Sakuma
    @TaiSakuma
    @nsmith- thank you. I would like to be in.
    Henry Schreiner
    @henryiii
    @nsmith- I’d be interested too
    benkrikler
    @benkrikler
    Me too!
    benkrikler
    @benkrikler
    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?
    Jim Pivarski
    @jpivarski
    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.
    benkrikler
    @benkrikler
    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?
    Nicholas Smith
    @nsmith-
    make a notebook with an example in the repo?
    Hans Dembinski
    @HDembinski
    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.
    Michael Hedges
    @mhedges
    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
    Chris Burr
    @chrisburr
    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)
    Michael Hedges
    @mhedges
    Thanks. This would be the equivalent of histtype='step' in matplotlib.pyplot, right?
    Chris Burr
    @chrisburr
    Yup though the best way to do it for a already binned histogram data is less obvious
    Michael Hedges
    @mhedges
    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
    Nicholas Smith
    @nsmith-
    feel free to add material to https://github.com/nsmith-/mpl-hep/blob/master/binder/gallery.ipynb (I can add you to the repo if you don't want to fork)
    Michael Hedges
    @mhedges
    Thanks. I'm fine with a fork
    Nicholas Smith
    @nsmith-
    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
    Nicholas Smith
    @nsmith-
    Hi all, I'll be giving a short presentation about this subject tomorrow: https://indico.cern.ch/event/803122/ Anyone have input they'd like to see mentioned?
    Henry Schreiner
    @henryiii
    Today’s IRIS-HEP topical meeting may be of interest, it’s over mpl-hep and histograms.
    Chris Tunnell
    @tunnell
    @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
    Nicholas Smith
    @nsmith-
    yes, indeed we would like to find any changes to matplotlib that would make things easier
    Lina Alasfar
    @alasfar-lina
    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
    I tried for example to adapt Box Histograms to mpl:
    https://github.com/alasfar-lina/box_is2d
    Hans Dembinski
    @HDembinski
    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
    Replacing typuv
    Typical ROOT plots with matplotlib equivalents. The first step is to identify "typical" plots, like your 2d box plot.