scikit-hep / histbook

Versatile, high-performance histogram toolkit for Numpy.
BSD 3-Clause "New" or "Revised" License
109 stars 9 forks source link

Sensible plotting defaults for trivial cases #36

Closed imandr closed 6 years ago

imandr commented 6 years ago

If I have a Hist with only one axis and I want to plot it, it would be convenient for me not to have to re-specify the axis expression. For example,

histogram = Hist(bin("x", 10, -5, 5))     # simple one-axis histogram
histogram.fill(...)
histogram.step().to(canvas)      # default: step("x")

Sensible defaults exist in more complicated cases:

histogram = Hist(bin("x", 10, -5, 5), bin("y", 10, 0, 1))     # simple one-axis histogram
histogram.fill(...)
histogram.heatmap().to(canvas)      # default: heatmap("x", "y")
jpivarski commented 6 years ago

Try both of these. I'm pretty sure that's how it works. Reopen this if I'm wrong.

jpivarski commented 6 years ago

It's what the documentation says.

imandr commented 6 years ago

Yes, seems to work. You are right. Thanks !