UnfoldMakie.RelativeAxis
— TypeRelativeAxis(fig, p::NTuple{4, Float64}; kwargs...)
Returns an Axis
whose position is relative to a GridLayout
element (via BBox
) and not relative to the Scene
. Default behavior is Axis(..., bbox = BBox())
.
p::NTuple{4,Float64}
: specify the position relative to the GridPosition left:right; bottom:top, typical numbers between 0 and 1, e.g. (0.25, 0.75, 0.25, 0.75) would center anAxis
inside thisGridPosition
.kwargs...
- inserted into the axis.f = Figure() ax = RelativeAxis(f[1, 2], (0.25, 0.75, 0.25, 0.75)# returns Axis centered within f[1, 2]
Return Value: Axis
.
UnfoldMakie.eeg_topoplot_series
— Function eeg_topoplot_series(data::DataFrame,
fig,
data_inp::Union{<:Observable,<:AbstractMatrix};
layout = nothing,
xlabels = nothing,
labels = nothing,
rasterize_heatmaps = true,
interactive_scatter = nothing,
highlight_scatter = false,
topo_axis = (;),
topo_attributes = (;),
positions,
)
eeg_topoplot_series!(fig, data::DataFrame; kwargs..)
Plot a series of topoplots. The function takes the combinefun = mean
over the :time
column of data
.
fig
Figure object.data::Union{<:Observable,<:AbstractMatrix}
Matrix with size = (nchannel, ntopoplots).layout::Vector{Tuple{Int64, Int64}}
Vector of tuples with coordinates for each topoplot.xlabels::Vector{String}
Vector of xlabels for each topoplot.topo_axis::NamedTuple = (;)
Here you can flexibly change configurations of the topoplot axis.
To see all options just type?Axis
in REPL.
Defaults: (aspect = 1, title = "", xgridvisible = false, xminorgridvisible = false, xminorticksvisible = false, xticksvisible = false, xticklabelsvisible = false, xlabelvisible = true, ygridvisible = false, yminorgridvisible = false, yminorticksvisible = false, yticksvisible = false, yticklabelsvisible = false, ylabelvisible = false, leftspinevisible = false, rightspinevisible = false, topspinevisible = false, bottomspinevisible = false, xpanlock = true, ypanlock = true, xzoomlock = true, yzoomlock = true, xrectzoom = false, yrectzoom = false)topo_attributes::NamedTuple = (;)
Here you can flexibly change configurations of the topoplot interoplation.
To see all options just type?Topoplot.topoplot
in REPL.
Defaults: interp_resolution = (128, 128), interpolation = CloughTocher().positions::Vector{Point{2, Float32}}
Channel positions. The list of x and y positions for all unique electrodes.
Return Value: Tuple{Figure, Vector{Any}}
.
UnfoldMakie.config_kwargs!
— Functionconfig_kwargs!(cfg::PlotConfig; kwargs...)
Takes NamedTuple of Key => NamedTuple
as kwargs and merges the fields with the defaults.
UnfoldMakie.eeg_array_to_dataframe
— Functioneeg_array_to_dataframe(data::AbstractMatrix, label_aliases::AbstractVector)
eeg_array_to_dataframe(data::AbstractVector, label_aliases::AbstractVector)
eeg_array_to_dataframe(data::Union{AbstractMatrix, AbstractVector{<:Number}})
Helper function converting an array (Matrix or Vector) to a tidy DataFrame
with columns :estimate
, :time
and :label
(with aliases :color
, :group
, :channel
).
Format of Arrays:
- times x condition for plot_erp.
- channels x time for plot_butterfly, plot_topoplotseries.
- channels for plot_topoplot.
Return Value: DataFrame
.
UnfoldMakie.rel_to_abs_bbox
— Functionrel_to_abs_bbox(org, rel)
Takes a rectangle org
consiting of coordinates of origins and applies the relative transformation tuple rel
.
Return Value: Makie.BBox
.
UnfoldMakie.to_positions
— Functionto_positions(x, y, z; sphere = [0, 0, 0.])
to_positions(pos::AbstractMatrix; sphere = [0, 0, 0.])
Projects 3D electrode positions to a 2D layout. Reimplementation of the MNE algorithm.
Assumes size(pos) = (3, nChannels)
when input is AbstractMatrix
.
Tip: You can get positions directly from an MNE object after loading PyMNE and enabling the UnfoldMakie PyMNE extension.
Return Value: Vector{Point2{Float64}}
.
UnfoldMakie.data_binning
— Functiondata_binning(df; col_y = :erp, fun = mean, grouping = [])
Group DataFrame
according to topoplot coordinates and apply aggregation function.
Arguments:
df::AbstractTable
Requires columns:cont_cuts
,col_y
(default:erp
), and all columns ingrouping
(col_coord
,row_coord
,label
);col_y = :erp
The column to combine over (withfun
);fun = mean()
Function to combine.grouping = []
Vector of symbols or strings, columns to group by the data before aggregation. Values ofnothing
are ignored.
Return Value: DataFrame
.
UnfoldMakie.cart3d_to_spherical
— Functioncart3d_to_spherical(x, y, z)
Convert x, y, z electrode positions on a scalp to spherical coordinate representation.
Return Value: Matrix
.