Repository navigation
961 pairplot - #1084
961 pairplot#1084
Conversation
There was a problem hiding this comment.
high-level review: This is so great!!! Thanks a ton for improving the plotting 🎉
Before a detailed review,
- can you please add type annotations to the arguments of the new functions,
- and run
pre-commithooks. it seems the formatting is inconsistent. make sure you are usingpre-commit --version3.5.0. then runpre-commit run --all-files
thanks 🙏
Checks have now passed. I will still update the plot tests (which run but throw many deprecation warnings), add typing for the non main functions, and update the conditional plots next week |
No worries, now I got you and agree. In a world with enough time, should do that. pytest also allows for marks that ignore things on a per-function-level. It didn't work instantly for me, so I went for this solution. Feel free to change it. However, I think that our time is better spent on other things :) |
janfb
left a comment
There was a problem hiding this comment.
Great effort!
I added a couple of comments. Will have a look at the tutorial later.
Co-authored-by: Jan <[email protected]>
Co-authored-by: Jan <[email protected]>
Co-authored-by: Jan <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1084 +/- ##
==========================================
- Coverage 76.37% 74.21% -2.17%
==========================================
Files 84 90 +6
Lines 6507 6927 +420
==========================================
+ Hits 4970 5141 +171
- Misses 1537 1786 +249
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Co-authored-by: Jan <[email protected]>
Co-authored-by: Jan <[email protected]>
Co-authored-by: Jan <[email protected]>
janfb
left a comment
There was a problem hiding this comment.
Sorry for the delay in reviewing!
It all looks good now, except for the two comments about the unused limit kwargs - I think it's better to remove them.
I also had a look at the tutotial and I think it's great!! 👏
Just one comment: it is using the example_posterior, so the data is in parameter space. However, you are using x_1 (...) as labels later. I suggest to change this to theta_1 (...) and to replace x_o with theta_o.
Thanks again for this revolutionary plotting update! 🙏
|
Ping @Matthijspals :) |
Hi Jan, sorry for the delay! Do you mean to change: into: or to make to limits part of the kwargs Dict? |
|
No worries!
|
Just dropping the |
|
Oh, I see. I finally understand why they were there in the first place :) Then I suggest that we just keep them and add an inline comment or info in the docstring why they are there. |
Will do!
The x and y limits are currently set for every plot in the |
janfb
left a comment
There was a problem hiding this comment.
Looks good!
Thanks a lot @Matthijspals 👏
…sion Since sbi-dev#1084 (v0.23.0), `_arrange_grid` gives one-row plots a placeholder row index of 1 and drew every diagonal from `row`. So each `marginal_plot` panel showed dimension 1, inside the axis range of its own dimension, and 1-D samples raised an IndexError. Select the data by `col`, which equals `row` on a `pairplot` diagonal, so `pairplot` draws the same as before. `_arrange_grid` also decided "single panel" from the data dimension, so `marginal_plot(s, subset=[0])` and `pairplot(s, subset=[0])` failed with "'Axes' object is not subscriptable". Decide it from the number of panels instead, also where the "..." marker for omitted dimensions is placed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this implement/fix? Explain your changes
Refactoring of the
pairplotandmarginal_plotfunctions, to make the plotting more transparent and easier to understand.Here is a summary of all changes:
Passing keywords:
upper_kwargs,lower_kwargs,diag_kwargsandfig_kwargsdictionaries (similar toseaborn), making it easier to organise keywordsupper_kwargs,lower_kwargs, anddiag_kwargscan includempl_kwargs, which is directly passed to thematplotlibplotting function used, making it straightforward to change e.g. thecmapused.Tutorial:
Restructuring of functions:
get_offdiag_funcsis declared outside ofpairplot, bringing it inline withget_diac_funcs, and makingpairploteasier to parseplt_hist_1d,plt_kde_2d, have their own function, making the code easier to parse, and making it easier to add new functionsarrange_plotsis replaced byarrange_grid, which uses the newly defined plotting functions and avoids mixingpltandaxformat_subplotdiagcan beNoneto only plot 2D marginalsDoes this close any currently open issues?
Adresses #961
Any relevant code examples, logs, error output, etc?
See here for more examples
Any other comments?
I did not change any of the defaults, as I felt it is quite subjective what is desired, we could discuss whether defaults should be changed or not.
Once this is roughly approved
conditional_pairplotandconditional_marginal_plotshould be updated to be inline with the new functions.Some tutorial plots should use updated syntax for plotting to avoid throwing deprecation warnings.
Checklist
Put an
xin the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.
guidelines
with
pytest.mark.slow.guidelines
main(or there are no conflicts withmain)