Closed veprbl closed 5 years ago
Just to let you know, the future of histbook is uncertain because I learned about the existence of Boost.Histogram and Physt, both excellent histogramming libraries available in Python. (Boost.Histogram was once and will again be available in Python, after it gets refactored from Boost.Python to pybind11.)
Now, about your question: have you tried just
histogram.step("data")
in a cell? The object returned by step
(and the other plotting routines) has a _repr_mimebundle_
already. That makes these things easier to view in JupyterLab than in Jupyter Notebook, but I had too many Notebook users to complicate the instructions about needing .to(canvas)
(and there was no way to make it work in both Lab and Notebook). Since each object has a _repr_mimebundle_
, doing
histogram.step("data1")
histogram.step("data2")
histogram.step("data3")
ought to get you three displays, no?
Just to let you know, the future of histbook is uncertain because I learned about the existence of Boost.Histogram and Physt, both excellent histogramming libraries available in Python.
I remember that you say that you'd rather contribute ideas than maintain a code, but I fail to understand how any of these packages can cover functionality of histbook.
histogram.step("data1") histogram.step("data2") histogram.step("data3")
ought to get you three displays, no?
Ofcourse not. It happens for the same reason why
1
2
3
gives only 3
and there was no way to make it work in both Lab and Notebook
I think I'm proposing exactly the way to do that.
Last I tried it, Notebook ignored the Vega mimetype.
@jpivarski Absolutely. I meant that both Notebook and Lab to use .to(canvas)
.
I haven't yet wrapped my head around how this makes it work for Notebook (since Notebook required a custom-Javascript solution, pyvega
, which isn't allowed in Lab, and then it overrides the mimetype— that's why I couldn't have both). However, if it does work, then congratulations (!) and could you submit a pull request?
To keep you aware of developments, I've been working on a cross-library, cross-language histogram RPC format with all the bells and whistles so that histograms from any histogramming library can be encoded in it. Then we can let Boost.Histogram becomes the best filler, Physt be the best plotter, etc. This is histos (from the Greek; we had a long exchange about the etymology of the name "histogram").
I also (just this morning) got rights to the pip name "hist". I might put a nice front-end to histos in a package that can be installed with "pip install hist" that would take most of the functionality of histbook. The one thing that would be held back is histbook's call-graph optimization of expressions— this rightly belongs in a computation engine like awkward-array.
Currently, the README advises to just drop
.to(canvas)
call and let jupyterlab try to display the histogram object. Often times it is convenient to output multiple histograms from the same cell. For that case one can useI think many people would want to know about that. Even further, it would make sense to unify interface for this. I think something like this can be implemented as a part of
histbook.vega
:What do you think about this?