-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement axes logscales #328
Conversation
…_xlim` which should really be determined by the contourplots
…espite checking for axes limits
…t_1d`, and `plot_2d` which takes a list of parameters that are to be plotted on a log-scale
… already existing axes and newly to create axes
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #328 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 34 34
Lines 2868 2969 +101
==========================================
+ Hits 2868 2969 +101
☔ View full report in Codecov by Sentry. |
… calls to `plot_1d` or `plot_2d`
@williamjameshandley, anything else that needs addressing here? |
Just had chance to read this properly, stunning work @lukashergt |
Could this be because |
Now I'm wondering if the x and y limits should actually be the same if only one of them is logarithmic |
…where issues reside
…use data bounds for fastkde by default
… bounds, but they ruin Gaussian results, this is very different from gaussian_kde, so for fastkde we actually would need to provide prior bounds and it is not good enough to infer bounds from the data...
Thanks for catching this. This was a subtle thing to do with More concretely, the problem here was coming from the non-logarithmic plots with data close to zero such that after accounting for a margin the limits had negative numbers which then are wrong for the logarithmic plots. I've added tests in 18209f8.
I have decoupled them now. |
…cal are logarithmic or vice versa, where those limits should not emit
…ould actually fail
lgtm. Great work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this looks great. I will test it out in the wild for my GAMBIT runs in the near future and get back to you if I think anything needs adjusting.
Sorry, missed the approval. Thanks for the reviews. |
This PR implements logarithmic scaling of select plotting axes in triangle/rectangle plots. Effectively this means that a quantity
log(x)
is plotted while the axes labels showx
with logarithmically spaced tick labels.NOTE: This has to be set up at axes creation. A simple re-scaling of x- or y-axis (e.g.
ax.set_xscale('log')
) won't work, but lead to distorted plots. To correctly compute histogram bins or KDEs, the computation has to be performed in logspace from the start.The way I set this up here is through a
logx
kwarg formake_1d_axes
orplot_1d
, and through alogxy
kwarg formake_2d_axes
orplot_2d
. This relates to the pandas kwargslogx
andlogy
, e.g. in pandas.DataFrame.plot.Example usage:
To see the added documentation:
https://anesthetic.readthedocs.io/en/logscale/plotting.html#log-scale
This PR was motivated by a discussion with @williamjameshandley and might be useful for some upcoming Gambit runs.
Checklist:
flake8 anesthetic tests
)pydocstyle --convention=numpy anesthetic
)python -m pytest
)