mne-tools / mne-tools/mne-python

Add color parameter to mne.viz.plot_sensors function

Open
#11,214 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ENH
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Describe the new feature or enhancement

A color parameter being of shape (n_sensors, color) would be a great addition for visualization in the mne.viz.plot_sensors function.

E.g. currently in the ECoG Plotting Tutorial https://mne.tools/stable/auto_tutorials/clinical/30_ecog.html#sphx-glr-auto-tutorials-clinical-30-ecog-py only one color for all sensor locations are used by default. I looked up in the used function _plot_sensors() in mne.viz._3d.py that the function _plot_glyphs() is called which uses a a single tuple color (1.0,1.0,1.0) for all sensor locations.

I am not sure how easy that would be to adapt, but certainly a great addition!

Describe your proposed implementation

Additional function parameter in the function mne.viz.plot_sensors

Describe possible alternatives

Otherwise the renderer in mne.viz._3d.py would need to be called for every individual sensor with a single color:

renderer.sphere(center=loc[loc_idx, :], color=color, scale=scale,
                               opacity=opacity,
                               backface_culling=backface_culling)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mne.viz.plot_sensors and trace its call to _plot_sensors() and _plot_glyphs() in mne.viz._3d.py. Review how the ECoG Plotting Tutorial uses the function, then define and implement per-sensor color handling so different sensor locations can receive different colors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.