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

add categorical legend to mne_connectivity.viz.plot_connectivity_circle so node_colors can be interpreted #244

Open
JohannesWiesner opened this issue Oct 18, 2024 · 4 comments

Comments

@JohannesWiesner
Copy link

If your issue is a usage question, please consider asking on the
MNE Forum instead of opening an issue.

Describe the problem

mne_connectivity.viz.plot_connectivity_circle allows you to map node names to colors by providing a node_colors argument. However, in order for the viewer to understand these colors it would be useful if a categorical legend could be added that maps each color to the corresponding label.

Describe your solution

Add node_colors_legend as argument.

Describe possible alternatives

A clear and concise description of any alternative solutions or features you have considered.

Additional context

Add any other context or screenshots about the feature request here.

@tsbinns
Copy link
Collaborator

tsbinns commented Oct 21, 2024

Hi Johannes,

I don't have the authority to say yes or no to this (would need @larsoner , @drammock, or @adam2392 for that), but just to explore what you're thinking of: are you imagining node_colors_legend as a boolean? Also, how do you envision it would interact with the existing node labels, e.g., should just a regular vertical legend be shown instead of the radial labels?

Cheers,
Thomas

@larsoner
Copy link
Member

As with #245 I wonder if this could be done easily enough with some call to ax.legend(...) after the figure is created? That way users have the flexibility to decide what needs to be in the legend and what doesn't, etc.

@JohannesWiesner
Copy link
Author

what you're thinking of: are you imagining node_colors_legend as a boolean?

Good question but now that you're asking: I have only thought about categorical color scales, i.e. each node is assigned to one category that maps to a certain color (e.g. left hemisphere = blue, right hemisphere = red). But there could be cases where users might want to map a continuous property.

My first intuition was a simple legend that maps discrete colors to labels. Similar to:

https://stackoverflow.com/questions/62894563/add-3-or-more-legends-to-a-seaborn-clustermap

In that case node_colors_legend could for example by a dictionary that maps strings (the labels) to R,G,B values.

@JohannesWiesner
Copy link
Author

As with #245 I wonder if this could be done easily enough with some call to ax.legend(...) after the figure is created? That way users have the flexibility to decide what needs to be in the legend and what doesn't, etc.

Will try this out!

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

No branches or pull requests

3 participants