-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
FIX: Improve channel name rendering in plot_alignment
#13773
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
Open
aman-coder03
wants to merge
7
commits into
mne-tools:main
Choose a base branch
from
aman-coder03:fix-show-channel-names-rendering
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
afe6247
reduce text scale and improve contrast
aman-coder03 a9eca8f
switch text color back to white
aman-coder03 6ab310d
use add_point_labels for show_channel_names
aman-coder03 11462b9
add changelog entry
aman-coder03 e834a28
address review comments
aman-coder03 76d76a2
Update doc/changes/dev/13773.bugfix.rst
aman-coder03 54595aa
Merge branch 'main' into fix-show-channel-names-rendering
aman-coder03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Make channel name labels easier to read in :func:`mne.viz.plot_alignment`, by `Aman Srivastava`_. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 have concerns about circumventing mne.viz.backends._pyvista.PyVistaRenderer.text3d and reaching straight for
renderer.plotter.add_point_labels, because the aforementioned text3d does some checks/sanitizing, e.g.:mne-python/mne/viz/backends/_pyvista.py
Lines 755 to 756 in ba12118
@drammock WDYT?
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.
for PyVista questions I always ask @larsoner 😆 But looking at the PyVista docs, I don't see any indication that add_point_labels is especially low-level or dangerous. That said, I agree that since we seem to have taken pains to add a wrapper for it, it was probably for a good reason and we should probably use the wrapper.
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.
OK! - my specific concern is just that here we hardcode
always_visible=Truewhereas intext3dwe check to see if that parameter exists (given the users version of PyVista(??..) ). Maybe that check is outdated and our lower pin guarantees the existence of this parameter, but someone would need to check...@aman-coder03 is there a specific reason why we need to use
add_point_labelsinstead oftext3dhere? What was your motivation for using switching to it?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.
@scott-huberty good point...
the reason I switched to
add_point_labelsdirectly was to pass all labels at once as a batch and to useshadow=Trueandshow_points=Falsewhich aren't available through the text3d wrapper but yeah bypassingtext3dto get those params isn't ideal. I think the cleanest fix would be to just extendtext3din_pyvista.pyto accept shadow andshow_pointsas parameters and pass them through, that way we keep the version check foralways_visibleand everything stays within the wrapper.happy to do that if @drammock and @larsoner are okay with it!
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.
SGTM