EEG Topoplots
The eeg_topoplot
recipe adds a bit of convenience for plotting Topoplots from EEG data, like drawing a head shape and automatically looking up default positions for known sensors. Otherwise, it supports the same attributes as topoplot
.
TopoPlots.eeg_topoplot
— Functioneeg_topoplot(data::Vector{<: Real}, labels::Vector{<: AbstractString})
Attributes:
positions::Vector{<: Point} = Makie.automatic
: Can be calculated from label (channel) names. Currently, only 10/20 montage has default coordinates provided.head = (color=:black, linewidth=3)
: draw the outline of the head. Set to nothing to not draw the head outline, otherwise set to a namedtuple that get passed down to theline!
call that draws the shape.
Some attributes from topoplot are set to different defaults:
label_scatter = true
contours = true
Otherwise the recipe just uses the topoplot
defaults and passes through the attributes.
So for the standard 10/20 montage, one can drop the positions
attribute:
using TopoPlots, CairoMakie
labels = TopoPlots.CHANNELS_10_20
TopoPlots.eeg_topoplot(rand(19), labels; axis=(aspect=DataAspect(),), label_text=true, label_scatter=(markersize=10, strokewidth=2,))
If the channels aren't 10/20, one can still plot them, but then the positions need to be passed as well:
data, positions = TopoPlots.example_data()
labels = ["s$i" for i in 1:size(data, 1)]
TopoPlots.eeg_topoplot(data[:, 340, 1], labels; positions=positions, axis=(aspect=DataAspect(),))
TopoPlots.example_data
— Functionexample_data()
Load EEG example data.
Returns a two-tuple:
- data: a (64, 400, 3) Float32 array of channel x timepoint x stat array. Timepoints correponds to samples at 500Hz from -0.3s to 0.5s relative to stimulus onset. Stats are mean over subjects, standard errors over subjects, and associated p-value from a t-test. For demonstration purposes, the first stat dimension is generally the most applicable.
- positions: a length-64 Point2f vector of positions for each channel in data.
Data source
Ehinger, B. V., König, P., & Ossandón, J. P. (2015). Predictions of Visual Content across Eye Movements and Their Modulation by Inferred Information. The Journal of Neuroscience, 35(19), 7403–7413. https://doi.org/10.1523/JNEUROSCI.5114-14.2015