Skip to content
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

[FIX] allow using symmetric maps with plotly #3942

Merged
merged 13 commits into from Sep 2, 2023

Conversation

Remi-Gau
Copy link
Collaborator

Changes proposed in this pull request:

  • allow using symmetric maps with plotly

@github-actions
Copy link
Contributor

github-actions bot commented Aug 30, 2023

👋 @Remi-Gau Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention Closes #XXXX (see our documentation on PR structure)
  • Code is PEP8-compliant (see our documentation on coding style)
  • Changelog or what's new entry in doc/changes/latest.rst (see our documentation on PR structure)

For new features:

  • There is at least one unit test per new function / class (see our documentation on testing)
  • The new feature is demoed in at least one relevant example.

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

We will review it as quick as possible, feel free to ping us with questions if needed.

@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #3942 (8e44164) into main (25e4bdd) will increase coverage by 0.00%.
Report is 10 commits behind head on main.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #3942   +/-   ##
=======================================
  Coverage   91.76%   91.77%           
=======================================
  Files         134      134           
  Lines       15747    15751    +4     
  Branches     3283     3283           
=======================================
+ Hits        14451    14455    +4     
  Misses        752      752           
  Partials      544      544           
Flag Coverage Δ
macos-latest_3.10 91.68% <100.00%> (+<0.01%) ⬆️
macos-latest_3.11 91.68% <100.00%> (+<0.01%) ⬆️
macos-latest_3.8 91.64% <100.00%> (+<0.01%) ⬆️
macos-latest_3.9 91.64% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.10 91.68% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.11 91.68% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.8 91.64% <100.00%> (+<0.01%) ⬆️
ubuntu-latest_3.9 91.64% <100.00%> (+<0.01%) ⬆️
windows-latest_3.10 91.62% <100.00%> (+<0.01%) ⬆️
windows-latest_3.11 91.62% <100.00%> (+<0.01%) ⬆️
windows-latest_3.8 91.59% <100.00%> (+<0.01%) ⬆️
windows-latest_3.9 91.59% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
nilearn/plotting/surf_plotting.py 95.48% <100.00%> (ø)

... and 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Remi-Gau Remi-Gau marked this pull request as ready for review August 30, 2023 20:27
Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise.

nilearn/plotting/tests/test_surf_plotting.py Outdated Show resolved Hide resolved
Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx

nilearn/plotting/tests/test_surf_plotting.py Outdated Show resolved Hide resolved
nilearn/plotting/surf_plotting.py Outdated Show resolved Hide resolved
@ymzayek
Copy link
Member

ymzayek commented Aug 31, 2023

Another solution would be to just remove symmetric_cmap=False from the call to plot_surf. This is the default of the function so it shouldn't have any behavior effects if symmetric_cmap is not passed to plot_sur_roi and if it is passed it will be unpacked from the kwargs and passed to plot_sruf

@Remi-Gau
Copy link
Collaborator Author

Another solution would be to just remove symmetric_cmap=False from the call to plot_surf. This is the default of the function so it shouldn't have any behavior effects if symmetric_cmap is not passed to plot_sur_roi and if it is passed it will be unpacked from the kwargs and passed to plot_sruf

Silly me. I had not even checked.
Sounds simpler and more elegant.
Will check the other parameters just to be sure.
But won't fix before tomorrow. Am AFK today.

@Remi-Gau
Copy link
Collaborator Author

Remi-Gau commented Sep 1, 2023

Another solution would be to just remove symmetric_cmap=False from the call to plot_surf. This is the default of the function so it shouldn't have any behavior effects if symmetric_cmap is not passed to plot_sur_roi and if it is passed it will be unpacked from the kwargs and passed to plot_sruf

implemted your suggestion instead

hemi='left',
view='lateral',
engine='matplotlib',
avg_method='median',
Copy link
Collaborator Author

@Remi-Gau Remi-Gau Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a default argument for avg_method that was implicitly passed to to plot_surf (but with a different default than that of plot_surf) and could lead to similar problems as for symmetric_cmap.

This is technically a change of the API in the doc though it could always be passed as kwarg. Should we mention it in an "added in version" ? I would say no but this is not a hill I will die on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not indeed (no strong feeling on my side.)

@Remi-Gau Remi-Gau merged commit 6578329 into nilearn:main Sep 2, 2023
29 checks passed
@Remi-Gau Remi-Gau deleted the symmetric_map_plotly branch September 2, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Plot surf ROI with plotly engine cannot do symmetric colorbars
3 participants