pymc-devs / pymc

Bayesian Modeling and Probabilistic Programming in Python
https://docs.pymc.io/
Other
8.71k stars 2.01k forks source link

How to re-style forestplot and other plots? #2169

Closed ericmjl closed 7 years ago

ericmjl commented 7 years ago

For presentation purposes, I'm just wondering whether it's possible to, say, make the forestplot lines thicker? Would it be best accomplished by taking the gridspec object that's returned and manipulating that directly? (Was just looking for a yes/no/short answer, don't want to take up too much of your time!)

ColCarroll commented 7 years ago

That's probably the best way -- I think we recently started returning figs/axes/gridspecs for all the plotting functions. I would be interested to hear how easy/hard customizing this is: if there's an object you need that isn't returned, happy to make a quick PR.

ericmjl commented 7 years ago

@ColCarroll thanks for the quick response! I'm thinking of thickening the forestplot lines, but I'm not quite sure how to manipulate a gridspec object - I know how to get the list of children from an axes object, though. Just wondering what the design considerations were in making the forestplot return gridspec rather than axes? While I've tried, I can't seem to figure that out from reading the source code.

ColCarroll commented 7 years ago

I'm definitely not an expert with matplotlib, but if I recall, gridspec is something of a deep cut, and I'm not sure the rationale for using it (except perhaps that it was convenient at the time?), though I have no easy suggestion to swap out for it. There is an open issue with gridspec playing poorly with resizing figures: https://github.com/pymc-devs/pymc3/issues/1946

@fonnesbeck fixed the bug(s) I introduced last time I touched that code, though.

ericmjl commented 7 years ago

I think I did a "good enough" hack -> plt.gca() to get the axes object, and then directly manipulating the children objects on there. Thanks for taking the time to respond though!