ERP grid
ERP grid is a plot type for visualisation of Event-related potentials. It can fully represent time, channel, and layout (channel locations) dimensions using lines. It can also partially represent condition dimensions. Lines are displayed on a grid. The location of each axis represents the location of the electrode. This plot type is not as popular because it is too cluttered.
Setup
Package loading
using Unfold
using UnfoldMakie
using CairoMakie
using UnfoldSim
include("../../../example_data.jl")
Main.example_data
Plot ERP grid
data, pos = TopoPlots.example_data()
data = data[:, :, 1]
f = Figure()
plot_erpgrid!(f[1, 1], data, pos; axis = (; xlabel = "s", ylabel = "µV"))
f
Configurations for Channel image
UnfoldMakie.plot_erpgrid
— Functionplot_erpgrid(data::Union{Matrix{<:Real}, DataFrame}, positions::Vector; kwargs...)
plot_erpgrid!(f::Union{GridPosition, GridLayout, Figure}, data::Union{Matrix{<:Real}, DataFrame}, positions::Vector, ch_names::Vector{String}; kwargs...)
Plot an ERP image.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Union{Matrix{<:Real}, DataFrame}
Data for the plot visualization.
Data should has a format of 1 row - 1 channel.positions::Vector{Point{2,Float}}
Electrode positions.ch_names::Vector{String}
Vector with channel names.hlines_grid_axis::NamedTuple = (;)
Here you can flexibly change configurations of the hlines on all subaxes.
To see all options just type?hlines
in REPL.
Defaults: (color = :gray, linewidth = 0.5)vlines_grid_axis::NamedTuple = (;)
Here you can flexibly change configurations of the vlines on all subaxes.
To see all options just type?vlines
in REPL.
Defaults: (color = :gray, linewidth = 0.5, ymin = 0.2, ymax = 0.8)lines_grid_axis::NamedTuple = (;)
Here you can flexibly change configurations of the lines on all subaxes.
To see all options just type?lines
in REPL.
Defaults: (color = :deepskyblue3,)labels_grid_axis::NamedTuple = (;)
Here you can flexibly change configurations of the labels on all subaxes.
To see all options just type?text
in REPL.
Defaults: (color = :gray, fontsize = 12, align = (:left, :top), space = :relative)
Keyword arguments (kwargs)
drawlabels::Bool = false
Draw channels labels over each waveform.times::Vector = 1:size(data, 2)
Vector ofsize()
.
Shared plot configuration options
The shared plot options can be used as follows: type = (; key = value, ...))
.
For example, plot_x(...; colorbar = (; vertical = true, label = "Test"))
.
Multiple defaults will be cycled until match.
Placing ;
is important!
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (xlabel = "Time", ylabel = "Voltage", xlim = [-0.04, 1.0], ylim = [-0.04, 1.0], fontsize = 12) - use kwargs...
of Makie.Axis
layout = (show_legend = true, use_colorbar = true) - check this page
mapping = (x = (:time,), y = (:estimate, :yhat, :y)) - use any mapping from AlgebraOfGraphics
visual = (colormap = :roma,) - use kwargs...
of Makie.lines
legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966) - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying ERP grid.
This page was generated using Literate.jl.