This is likely a very easy question, but I haven't found the answer. What's a quick way to
h.plot(...) with a logarithmic y-axis? I've tried
I could follow the example given in scikit-hep/hist#198 and extract the
ax object out of the output, but I'm writing a tutorial and I want to show how easy this is. (It's for the Uproot tutorial, but I'm trying to include related libraries.)
Hist.plotis sending some properties downstream (i.e. nothing to look up: they're defined by Matplotlib), in the StepPatch object it turns out.
axis definitely good. That's saved me a few times (in Pandas).
matplotlib.pyplot as pltis, duplicating the interface is not the way. For faster access I could see 2 options 1) have a shortcut to pyplot with
.plot()returning the ax object. I think Henry is very pro returning the artists, but the tuple with the artists could quite easily contain the ax as well. Then you could do
h_obj.plot().ax.semilogy()if you really wanted a one-liner
This isn't directly related, but this is reminding me of when I learned about how to use interactive vs. non-interactive
matploltlib backends earlier this year and how that relates between using the
h.view() / h2.view()
hist.hist.Histobject that someone else made and serialized to give to you, and upon deserializing realize that the
labelfield for the axes has information that should have been put in
metadataplaced in them (e.g.,
wjetsinstead of something like
pt) is there a way to update the
labelin a copy of the histogram?
labelare read only in boost-histogram, so is there any way to get around this other then manually making new histogram objects and filling them with the old histogram contents?
labelis easy, it's not read-only. Only name is, because we validate that it doesn't get duplicated inside a histogram. You can set it via a secret method (
hist_1.axes._ax.metadata, IIRC), but I've intended to allow it to be set in bulk, that is,
hist.axes.name = ("name1", "name2"), as that we can validate. I'll open an issue for that.
np.sqrt(h.values()))automatically? For generating ratio plots I understand I can use the
hist.intervalsmodule, is this the current "best practice"?