Plot EEG Graph.

Example to plot EEG graph using EEGrasp package. The EEG graph is constructed using the electrode positions from the Biosemi 64 channel montage. The graph is plotted in 3D and topoplot formats.

import matplotlib.pyplot as plt
import mne
import numpy as np

from eegrasp import EEGrasp
montage = mne.channels.make_standard_montage('biosemi64')
ch_names = montage.ch_names
EEG_pos = montage.get_positions()['ch_pos']
# Restructure into array
EEG_pos = np.array([pos for _, pos in EEG_pos.items()])
gsp = EEGrasp(coordinates=EEG_pos, labels=ch_names)
Z = gsp.compute_distance(EEG_pos)
G = gsp.compute_graph(sigma=0.1, epsilon=0.2)
fig, ax = gsp.plot()
fig, ax = gsp.plot(kind='3d')

plt.show()
  • Graph(n_vertices=64, n_edges=107)
  • Graph(n_vertices=64, n_edges=107)
/home/docs/checkouts/readthedocs.org/user_builds/eegrasp/envs/latest/lib/python3.11/site-packages/pygsp2/plotting.py:589: UserWarning: No data for colormapping provided via 'c'. Parameters 'vmin', 'vmax' will be ignored
  sc = ax.scatter(*G.coords.T,
/home/docs/checkouts/readthedocs.org/user_builds/eegrasp/envs/latest/lib/python3.11/site-packages/pygsp2/plotting.py:589: UserWarning: No data for colormapping provided via 'c'. Parameters 'vmin', 'vmax' will be ignored
  sc = ax.scatter(*G.coords.T,

Total running time of the script: (0 minutes 0.652 seconds)

Estimated memory usage: 192 MB

Gallery generated by Sphinx-Gallery