usingNeuroAnalyzerusingCairoMakieNeuroAnalyzer.progress_bar =false# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of# NeuroAnalyzer figures (e.g. the small and medium topographical maps): remove itdelete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)# preprocessed recording, EEG channels onlyeeg =load_neuro("files/eeg/eeg.hdf")eeg =keep_channel(eeg; ch ="eeg")e10 =epoch(eeg; ep_len =10)
A topographical map (topomap) shows the spatial distribution of a value (amplitude, power, a statistic, …) over the scalp: the values at the electrode locations are interpolated over the whole head. The object must contain channel locations (see the channel locations tutorial).
Plotting Topomaps
plot_topo() plots either the signal at a time point, or any values given for each channel.
The signal at a time point (tpos, in seconds); for a range of time points the signal is averaged (amethod = :mean or :median):
plot_topo(eeg; ch ="eeg", tpos =2.5)
Values of each channel are given using data, e.g. the power of the theta band (4–8 Hz):
theta =band_power(eeg; ch ="eeg", flim =band_frq(eeg; band =:theta))plot_topo(eeg; ch ="eeg", data = theta[:, 1], title ="Theta power")
By default, the values are normalized (nmethod = :minmax), so the colorbar is in arbitrary units. To plot the original values, use nmethod = :none:
plot_topo(eeg; ch ="eeg", data = theta[:, 1], nmethod =:none, cb_title ="[μV²/Hz]", title ="Theta power")
The theta power is highest over the posterior regions, where the slow posterior dominant rhythm of this recording is located.
plot_topo(eeg; ch ="eeg", data = theta[:, 1], ps =:s)
Thresholding
The map can be thresholded using the same rules as other plots (:eq, :neq, :geq, :leq, :g, :l, :in, :bin); the threshold is in the units of the plotted values (normalized values unless nmethod = :none). With threshold_method = :reg (default) only the region of the map meeting the threshold is shown:
With connections (a channels × channels matrix), the connections passing the threshold are drawn between the electrodes; the line widths and transparency are scaled by the connection strength. The correlation matrix of the first 10-second epoch, correlations > 0.8:
cm =corm(e10; ch ="eeg")[:, :, 1]plot_locs(eeg; ch ="eeg", connections = cm, threshold =0.8, threshold_type =:g, gui =false)
Connections can be plotted in the top (XY, default), front (XZ) and side (YZ) planes (plane). For legibility, it is recommended to disable the channel labels.
Only the upper triangle of the connectivity matrix is used, so the matrix should be symmetric. For directed (asymmetric) connectivity, draw two plots: one for the matrix and one for its transpose (m').
Positive values are drawn in red, negative values in blue.
The widths of the connections are scaled by their values.