question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2d head plot connectivity graph

See original GitHub issue

Describe the new feature or enhancement

It’s a viz feature that enables you to display a visualization of electrode connectivity. To be used in conjunction with the circle.py feature. I couldn’t find this feature that my employer requested I implement anywhere in the mne library so I made it myself.

Describe your proposed implementation

Screen Shot 2021-08-17 at 12 07 52 PM Screen Shot 2021-08-17 at 12 07 35 PM Screen Shot 2021-08-17 at 12 06 56 PM

Describe possible alternatives

Could be implemented with or without the heatmaps.

Additional comments

The heatmaps require the seaborn library the way I implemented them, and the head-graphs require the networkx library. These features have also been implemented with sliders so that the user can play with the thresholds --thresholding works differently from circle in that you don’t specify the number of connections to display you threshold based on connectivity measure, but it would be fairly easy to add that as an option.

I would have to check with my employer if it’s okay before adding this feature to the mne, I think they will be chill, besides we don’t have a legal contract anyway but I would want to check first so as not to break trust.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
drammockcommented, Aug 20, 2021

@larsoner @agramfort are you OK with what I proposed above? namely:

  1. add parameter plot_sensors_connectivity(..., kind='3d') (default, current behavior) and plot_sensors_connectivity(..., kind='topomap') (new behavior, uses matplotlib)
  2. add parameter plot_sensors_connectivity(..., ax=None) (default) that is ignored for 3d plots, and can be a matplotlib.axes.Axes instance for 2d plots
  3. don’t implement the heatmaps, because seaborn and matplotlib already handle that adequately

@dcxSt one final note that I forgot to mention earlier is that we’re moving our connectivity functions into a separate package, so you’ll actually want to make the PR into the mne-connectivity package. All the function names and APIs were migrated so everything should look familiar.

cc @adam2392 who has been overseeing the migration to a separate package

2reactions
drammockcommented, Aug 18, 2021

To me the best option seems to be expanding plot_sensors_connectivity to have a kind option (mne.viz.plot_sensors has kind='3d' and kind='topomap' and kind='select', but I don’t think we need “select” here). We can do the heatmap without relying on Seaborn (currently it’s not a dependency) and I’d argue we should do the sensors without nilearn (better to have consistent visual style with our other 2D sensor plots). I’d also try to do it without networkx if we can… ultimately it won’t make a difference to the end-user so again I’d rather avoid the extra dependency.

in which case there would be a 2d plotting function in the _3D.py file which may be bad ?

We can always move things around if it makes sense to do so. The API entry point is just mne.viz so it would be fine for the public function to have both 2D and 3D options, and under-the-hood it can call private functions that are possibly in different files.

I’m also thinking we could have a function built ontop of that that takes as it’s argument a connectivity 3-tensor (the type that is returned by spectral_connectivity) for plotting multiple connectivity bands side by side (like in the screenshots).

I’d split that into a separate PR after the first one is done… it could basically be a thin wrapper for the new 2D-capable plot_sensors_connectivity that handled creating the correct number of axes, making sure they all had the right colormap, etc

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotting with mne.viz.Brain — MNE 1.3.dev0 documentation
Brain for plotting data on a brain. import matplotlib.pyplot as plt from ... Plot source information. ... Add a head image using the...
Read more >
2-D line plot - MATLAB plot
This MATLAB function creates a 2-D line plot of the data in Y versus the ... To plot a set of coordinates connected...
Read more >
How to plot connected network nodes on graph?
I have the location of the nodes in 2d data file which is written by ... Can you guys help me plot those...
Read more >
Network visualization with R
Network maps are far from the only visualization available for graphs - other network ... simple base R plot chart below, x and...
Read more >
Graph and its representations
The networks may include paths in a city or telephone network or circuit ... Adjacency Matrix is a 2D array of size V...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found