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] Set edgecolors when plotting contours so that they are rendered #3973
Conversation
👋 @ymzayek 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.
For new features:
For bug fixes:
We will review it as quick as possible, feel free to ping us with questions if needed. |
Codecov Report
@@ Coverage Diff @@
## main #3973 +/- ##
==========================================
- Coverage 91.79% 91.69% -0.10%
==========================================
Files 134 134
Lines 15772 15781 +9
Branches 3284 3289 +5
==========================================
- Hits 14478 14471 -7
- Misses 751 767 +16
Partials 543 543
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 7 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
With this PR, the contours should render correctly again. Code to test: from nilearn import datasets
from nilearn import surface
from nilearn import plotting
import numpy as np
motor_images = datasets.fetch_neurovault_motor_task()
stat_img = motor_images.images[0]
fsaverage = datasets.fetch_surf_fsaverage()
texture = surface.vol_to_surf(stat_img, fsaverage.pial_right)
destrieux_atlas = datasets.fetch_atlas_surf_destrieux()
parcellation = destrieux_atlas['map_right']
regions_dict = {b'G_postcentral': 'Postcentral gyrus',
b'G_precentral': 'Precentral gyrus'}
regions_indices = [
np.where(np.array(destrieux_atlas['labels']) == region)[0][0]
for region in regions_dict
]
labels = list(regions_dict.values())
output_file = './plop.pdf'
fig = plotting.plot_surf_stat_map(
fsaverage.infl_right, texture, hemi='right',
threshold=1., bg_map=fsaverage.sulc_right,
# output_file=output_file
)
plotting.show()
output_file = './plop2.pdf'
plotting.plot_surf_contours(
fsaverage.infl_right, parcellation, labels=labels,
levels=regions_indices, figure=fig,
legend=True,
colors=['g', 'k'],
# output_file=output_file
) Uncomment the output_file argument to check rendering in PDF |
Contours are rendered again: https://output.circle-artifacts.com/output/job/2b6d2712-1278-44a8-bc36-25c8ad1b65a8/artifacts/0/dev/auto_examples/01_plotting/plot_3d_map_to_surface_projection.html#display-outlines-of-the-regions-of-interest-on-top-of-a-statistical-map vs bug in dev docs: https://nilearn.github.io/dev/auto_examples/01_plotting/plot_3d_map_to_surface_projection.html#display-outlines-of-the-regions-of-interest-on-top-of-a-statistical-map Side note: |
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 cannot reproduce with the code snippet you provided but I trust CI more than my own incompetence.
Good to go
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.
LGTM, thx.
plot_3d_map_to_surface_projection
examples are not being rendered correctly #3954