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

Marker size array is not well displayed in plot_glass_brain #2185

Closed
robbisg opened this issue Oct 17, 2019 · 2 comments · Fixed by #2186
Closed

Marker size array is not well displayed in plot_glass_brain #2185

robbisg opened this issue Oct 17, 2019 · 2 comments · Fixed by #2186

Comments

@robbisg
Copy link
Contributor

robbisg commented Oct 17, 2019

What version of Nilearn are you using?

In [36]: nilearn.__version__ 
Out[36]: '0.6.0a'

What were you trying to do?
Plot a connectome using plot_connectome function, giving the a numpy array as node_size.

Here's the snippet to replicate:
coords and colors are obtained by some functions I've implemented in my libraries.

from nilearn.plotting import plot_connectome
matrix = np.random.rand(90,90)
matrix = (matrix * matrix.T)/2
t_matrix = matrix * np.int_(matrix > 0.45) #Plot only some connections
f = plot_connectome(t_matrix, 
                        coords[:90], 
                        colors[:90], 
                        t_matrix.sum(0)*100, 
                        'magma_r',
                        display_mode='lyr',
                        edge_vmin=0.45,
                        edge_vmax=0.5,
                        figure=pl.figure(figsize=(25,15)),
                        )

What did you expect will happen?
fixed

What actually happened?
The node size of left and right images are different from those obtained in coronal view.
buggy

I've found the problem in displays.pyand fixed it by adding at line 417
Maybe we also need some control on array/list length.

            if isinstance(marker_size, np.ndarray) or \
                isinstance(marker_size, list):
                marker_size = np.array(marker_size)[relevant_coords]

I can do the PR, if you are ok.

@kchawla-pi
Copy link
Collaborator

kchawla-pi commented Oct 17, 2019 via email

@jeromedockes
Copy link
Member

jeromedockes commented Oct 17, 2019 via email

kchawla-pi pushed a commit that referenced this issue Oct 28, 2019
* FIX: marker size issue in plot_connectome #2185

* Update displays.py

* Update displays.py

List and numpy array accepted

* Update nilearn/plotting/displays.py

Co-Authored-By: jeromedockes <jerome@dockes.org>

* FIX: marker size issue in plot_connectome #2185

* Update whats_new.rst

* Update displays.py

* Fixed identation for flake
kchawla-pi added a commit to illdopejake/nilearn that referenced this issue Nov 9, 2019
…nt_modify_fetch_dev

* 'master' of https://github.com/nilearn/nilearn:
  Verbose doc building to ease tracking of progress & diagnose stalls (nilearn#2203)
  New conda env is created once conda path has been activated
  Conda environment is created for full-builds
  Refactor CircleCI config for reduced redundancy (nilearn#2204)
  Installation should fail on Python < 3.5 (nilearn#2198)
  [MRG] Add get data function (nilearn#2172)
  fix error when colorscale given boolean array (nilearn#2193)
  remove is_valid filter (nilearn#2169)
  Moved new entries to next release
  FIX: marker size issue in plot_connectome nilearn#2185 (nilearn#2186)
  Updated Appveyor status badge
  Run tests on local Windows machines & Azure Pipelines (nilearn#2191)
  Updated requirements list for devs (nilearn#2190)
  Update azure-pipelines.yml for Azure Pipelines
  Release Nilearn 0.6.0 alpha (nilearn#2164)
  Making fetch_localizer_button_task backwards compatibile (nilearn#2182)
  [DOC] Update whats_new to reference nilearn#2013 (Merging of several examples) (nilearn#2183)
kchawla-pi added a commit to pausz/nilearn that referenced this issue Nov 21, 2019
…smooth-image

* 'master' of https://github.com/nilearn/nilearn: (25 commits)
  Add testing for Nilearn setup & install & Fix the broken dependency installation (nilearn#2201)
  Fix uniform ball cloud test for sklearn >= 0.22 (nilearn#2175)
  MAINT: sklearn Deprecations (nilearn#2219)
  DOC: title in bold
  [DOC] Add note about decreasing memory usage (nilearn#2223)
  Rel 060b0 (nilearn#2208)
  Nilearn 0.6.0b0 release (nilearn#2206)
  Fixed the redundant & missing test case in merged PR nilearn#2035 (nilearn#2205)
  Modify fetch_development_fmri to fetch adults or children (nilearn#2035)
  Verbose doc building to ease tracking of progress & diagnose stalls (nilearn#2203)
  New conda env is created once conda path has been activated
  Conda environment is created for full-builds
  Refactor CircleCI config for reduced redundancy (nilearn#2204)
  Installation should fail on Python < 3.5 (nilearn#2198)
  [MRG] Add get data function (nilearn#2172)
  fix error when colorscale given boolean array (nilearn#2193)
  remove is_valid filter (nilearn#2169)
  Moved new entries to next release
  FIX: marker size issue in plot_connectome nilearn#2185 (nilearn#2186)
  Updated Appveyor status badge
  ...
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 a pull request may close this issue.

3 participants