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_topoplotFunction
eeg_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 the line! 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(),))