joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
357 stars 77 forks source link

`runplot` does not work with given `(fig,axes)` objects #96

Closed dhuppenkothen closed 6 years ago

dhuppenkothen commented 6 years ago

Thanks for your great work writing this package! I've been exploring it for use with multi-modal probability distributions, and have stumbled over the following issue while plotting results.

By default, the plot size for runplot is very large (16 by 16), so I thought I'd make it smaller by passing in my own (fig, axes) objects. However, when doing so, the following TypeError

TypeError: '<' not supported between instances of 'NoneType' and 'float'

is thrown by line 229 in plotting.py. A short investigation revealed that when the limits of the x- and y-axis are (0,1), they are replaced by (None, None), which breaks the min() and max() statements in the following line.

Minimum example:

 fig, axes = plt.subplots(4, 1, figsize=(8, 8))
 fig, axes = dyplot.runplot(results, fig=(fig, axes))  # summary (run) plot

A couple of possible solutions I could think of:

Anyway, happy to submit a pull request, I just wanted to check first what behaviour you expect here. :)

joshspeagle commented 6 years ago

Good find. I'm more than happy to take pull requests for any/all of the proposed solutions. Otherwise, I'll try and fix this during my next batch of changes in ~1 week.