-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
MRG, FIX, VIZ: refactor plot_evoked_topomap #7706
Conversation
cc @fraimondo you may be interested to test these changes, to make sure your |
@hoechenberger you will be interested in this too |
Ready for review. Note that @hoechenberger's use case that motivated this fix is still somewhat problematic, but I don't see a clear solution to either of these problems:
|
Codecov Report
@@ Coverage Diff @@
## master #7706 +/- ##
==========================================
+ Coverage 85.74% 90.05% +4.31%
==========================================
Files 455 455
Lines 84571 84621 +50
Branches 13400 13399 -1
==========================================
+ Hits 72512 76203 +3691
+ Misses 9323 5549 -3774
- Partials 2736 2869 +133 |
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.
- If a user plots to axes of an existing figure in multiple steps (as shown above), the colorbar will only be accurate for the subplots that were drawn at the same time as the colorbar. So, in the example above, the colorbar scale only is accurate for the bottom-left plot, not for the two top-row plots. I think this is unavoidable. May be worth a
Notes
section warning in the docstring.
I would almost think that common sense would tell you that, but yes, maybe a few words in the Notes section are justified anyway. :)
- In the same example, the colorbar fills the whole subplot space. Although this looks bad in the example above, I think it's actually what we should do when the user passes in their own axes
Yes to me this is expected behavior and should be exactly this way.
Just wondering, we had also discussed whether having a separate cbar_axes
kwarg could make sense. But I guess this solution here (last axes used for colorbar) is sufficiently flexible already. Considering a case where maybe I'd like to print 5 topographies with their own colorbar each into the same figure, I could simply create a 5-by-2 grid and plot the topomaps one after another, right?
Aside from my few comments, this looks very good to me and is definitely a great improvement to what we had before.
Please also add a changelog entry.
raise RuntimeError(f'You must provide {want_axes} axes (one for ' | ||
f'each time{cbar_err}), got {len(axes)}.') |
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.
❤️ The future is now ❤️
# axes were given by the user, so don't resize the colorbar | ||
cax = axes[-1] |
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 think this is the right thing to do. 👍
Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
@larsoner the Azure failure here was a one-hour timeout, but it looks like it managed to run all the tests successfully, and just barely ran out of time during the "finalize job" step. So I'm marking this as MRG, but let's talk (offline?) about pruning execution time some more (your favorite subject, I know). |
We already have a PR for the PyVista tests being slow, which accounts for a lot of the slowest ones: But feel free to open an issue about the other ones. I'm happy to take a look soon |
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.
Aside from the few tiny nitpicks, LGTM!
Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
Code LGTM, thanks @drammock ! |
closes #7595
Setup for testing:
interactive usage
current master
this PR
interactive without colorbar
current master
this PR
standard non-interactive usage
current master
this PR
standard usage no colorbar
current master
this PR
specifying rows/columns
current master
this PR
rows/columns, no colorbar
current master
this PR
user passes
axes
current master
Also returns
RuntimeError: Axes and times must be equal in sizes.
after closing the incomplete figure.this PR