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

Allow to plot asymmetric connectivity matrix with mne-connectivity.viz.plot_connectivity_circle #246

Open
JohannesWiesner opened this issue Oct 21, 2024 · 5 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

This function currently only supports plotting symmetric connectivity matrices (only the lower half of the matrix is used). However, in my case I would be interested in plotting asymmetric (directed) matrices.

See for example:
https://nilearn.github.io/dev/modules/generated/nilearn.plotting.plot_connectome.html

This function checks first if the user provided a symmetric or asymmetric matrix. If the matrix is asymmetric this of course has to be visualized. Can be done for example by using arrows instead of lines, different colors or different line shapes (dotted vs fixed lines).

Describe your solution

A clear and concise description of what you want to happen.

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 can definitely see the value in this for looking at directed connectivity scores. I suppose the challenge is finding a solution that is still somewhat legible with the additional information that would be present.

I think changing the colour of the lines is tricky since we are encoding the connectivity strength here. For interhemispheric connectivity you could have one colourbar for L -> R connectivity and one for R -> L, but what if you're also interested in intrahemispheric connectivity, or connectivity between different channels for a single region? Then defining line colours for different directions becomes tricky.

I see a similar problem with using solid vs. dotted lines: how do you define what directions these correspond to?

I think the most effective solution would be your suggestion of simply using arrows for asymmetric matrices instead of lines.

It would be good to hear from someone more senior if they would be happy with such a change. If so, @JohannesWiesner would you be willing to implement these changes? The code for handling this is actually in the main MNE package though, so it would require a PR there.

Cheers,
Thomas

@drammock
Copy link
Member

Two colormaps that each went from a single hue to transparent might also work. But it would only make sense to do it that way if there were a meaningful notion of "forward" and "backward" connections. Otherwise there is the same problem as with line style --- no way to guess which end is source and which is sink. So yeah, I can't think of anything better than using arrows.

@JohannesWiesner
Copy link
Author

Completely agree that arrows are the most intuitive approach! I guess that's why the nilearn folks also stick to that.

Two colormaps that each went from a single hue to transparent might also work. But it would only make sense to do it that way if there were a meaningful notion of "forward" and "backward" connections. Otherwise there is the same problem as with line style --- no way to guess which end is source and which is sink. So yeah, I can't think of anything better than using arrows.

That's exactly how I wanted to answer, any other formatting style would require a legend again that maps the formatting style to the direction so the viewer can interpret it.

@JohannesWiesner
Copy link
Author

If so, @JohannesWiesner would you be willing to implement these changes?

Perhaps over the christmas holidays but I can't promise :(

@tsbinns
Copy link
Collaborator

tsbinns commented Nov 11, 2024

Perhaps over the christmas holidays but I can't promise :(

There's no rush from our end. Unfortunately I would also not have time to work on this before January, but if there's still work to be done then I am happy to try lend a hand!

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