-
Notifications
You must be signed in to change notification settings - Fork 25
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] HistStack #169
Comments
@henryiii, just thinking out loud, why a "|" rather than a "&"? BTW, did you look at some of the functionality that was put into histbook in the past, before it got archived? Stacked histograms were also covered there and one may "steal" ideas from it. |
Because it's used in a lot of other places in Python now to mean union, such as sets, dicts (3.9+), and types (3.10+). I believe a "Book" in HistBook was a different thing, a set of different histograms that could be filled together, while this is a set of matching histograms that must have been filled differently. There was a "stack" method, but I think it was just a display style for a single histogram. Good idea to look at HistBook for (other, too) ideas! |
I see, fair enough for the "|", then. |
FYI: In Python 3.10, |
|
* feat: begin histstack * Update .pre-commit-config.yaml * feat: make HistStack work * Modify checks for categorical axis * Add check for matching axes types * feat & test: add a judgement for Hist.plot and tests for stacks * fix: skip Stack tests for Python 3.6 * fix: make axes match for Stack * feat: change Stack plotting implementation * test: remove tests for stack with different axes * feat: check mplhep dependency and allow Stack(unnamed_hist, named_hist) * feat: allow stack(ax1, ax2) but not allow plot, and without tests * fix: change the axes check back * feat: h.stack(name/idx) * test: add test for Stack reprs * test: add some tests for h.stack and Stack(axes) * fix: solve the circular import problem * refactor: working on Stack Co-authored-by: Aman Goel <aman.goel185@gmail.com> Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
For implicit constructor, aka |
I'm thinking 95% of users will likely do |
A possible design for stacked histograms is the following:
A HistStack holds multiple histograms; axes are required to match. Calling
.plot(...)
forwards to mplhep, just like Hist.plot, but with the stack of histograms as a list in the first argument.To make a stack, you could use
|
, so that:Would make a stack of histograms and plot it.
This also might tie into #165, possibly
.interp
on a stack would interpolate between histograms? Just a thought.EDIT: should have added to #34 instead...
The text was updated successfully, but these errors were encountered: