Channel image
Channel image is a plot type for visualizing EEG activity for all channels. It can fully represent time and channel dimensions using a heatmap. Y-axis represents all channels, x-axis represents time, while color represents voltage.
Package loading
using Unfold
using UnfoldMakie
using CairoMakie
using UnfoldSim
include("../../../example_data.jl")
Main.example_data
Plot Channel image
The following code will result in the default configuration.
data, pos = TopoPlots.example_data()
data = data[:, :, 1]
pos = pos[1:30]
raw_ch_names = ["FP1", "F3", "F7", "FC3", "C3", "C5", "P3", "P7", "P9", "PO7",
"PO3", "O1", "Oz", "Pz", "CPz", "FP2", "Fz", "F4", "F8", "FC4", "FCz", "Cz",
"C4", "C6", "P4", "P8", "P10", "PO8", "PO4", "O2"]
plot_channelimage(data, pos, raw_ch_names;)

Configurations for Channel image
UnfoldMakie.plot_channelimage
— Functionplot_channelimage!(f::Union{GridPosition, GridLayout, Figure}, data::Matrix{<:Real}, position::Vector{Point{2,Float32}}, ch_names::Vector{String}; kwargs...)
plot_channelimage(data::Matrix{<:Real}, position::Vector{Point{2,Float32}}, ch_names::Vector{String}; kwargs...)
Channel image
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::DataFrame
DataFrame with data.position::Vector{Point{2,Float32}}
A vector with EEG layout coordinates.ch_names::Vector{String}
Vector with channel names.
Shared plot configuration options
The shared plot options can be used as follows: type = (; key = value, ...))
.
For example, plot_x(...; layout = (; show_legend = true, legend_position = :right))
.
Multiple defaults will be cycled until match.
Placing ;
is important!
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (xlabel = "Time [s]", ylabel = "Channels", yticklabelsize = 14) - use kwargs...
of Makie.Axis
layout = (show_legend = true, legend_position = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, use_colorbar = false)
mapping = (x = (:time,), y = (:estimate, :yhat, :y))
visual = (colormap = Makie.Reverse{String}("RdBu"),) - use kwargs...
of Makie.heatmap
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, label = "Voltage [µV]", labelrotation = -1.5707963267948966) - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying the Channel image.
This page was generated using Literate.jl.