UnfoldMakie.RelativeAxis — Typeax = RelativeAxis(figlike, p::NTuple{4, Float64}; kwargs...)
Returns an axis whose position is relative to a GridLayout' element (viaBBox') 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 an Axis inside this GridPosition.
The kwargs... are 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]
UnfoldMakie.eeg_topoplot_series — Functionfunction eegtopoplotseries(data::DataFrame, Δbin; y=:estimate, label=:label, col=:time, row=nothing, figure = NamedTuple(), combinefun=mean, rowlabels = false, collabels = false, topoplot_attributes... )
Plot a series of topoplots. The function automatically takes the combinefun=mean over the :time column of data in Δbin steps.
- The data frame
dataneeds the columns:timeandy(=:erp), andlabel(=:label). Ifdatais a matrix, it is automatically cast to a dataframe, time bins are in samples, labels arestring.(1:size(data,1)). - Δbin in
:timeunits, specifying the time steps. All other keyword arguments are passed to the EEG_TopoPlot recipe. In most cases, the user should specify the electrode positions withpositions=pos. - The
colandrowarguments specify the field to be divided into columns and rows. The default iscol=:timeto split by the time field androw=nothing. Useful to split by a condition, e.g....(..., col=:time, row=:condition)would result in multiple (as many as different values in df.condition) rows of topoplot series. - The
figureoption allows you to include information for plotting the figure. Alternatively, you can pass a fig objecteeg_topoplot_series!(fig, data::DataFrame, Δbin; kwargs..). row_labelsandcol_labelsindicate whether there should be labels in the plots in the first column to indicate the row value and in the last row to indicate the time (typically timerange).
Examples
Desc
julia > df = DataFrame(:erp => repeat(1:63, 100), :time => repeat(1:20, 5 * 63), :label => repeat(1:63, 100)) # fake data
julia > pos = [(1:63) ./ 63 .* (sin.(range(-2 * pi, 2 * pi, 63))) (1:63) ./ 63 .* cos.(range(-2 * pi, 2 * pi, 63))] .* 0.5 .+ 0.5 # fake electrode positions
julia > pos = [Point2.(pos[k, 1], pos[k, 2]) for k in 1:size(pos, 1)]
julia > eeg_topoplot_series(df, 5; positions=pos)UnfoldMakie.eeg_topoplot_series! — Functioneegtopoplotseries!(fig, data::DataFrame, Δbin; kwargs..) In place plotting of topoplot series see eegtopoplotseries(data, Δbin) for help
UnfoldMakie.config_kwargs! — FunctionTakes a kwargs named tuple of Key => NamedTuple and merges the fields with the defaults
UnfoldMakie.eeg_matrix_to_dataframe — FunctionHelper function converting a matrix (channel x times) to a tidy dataframe with columns :estimate, :time and :label
UnfoldMakie.rel_to_abs_bbox — Functionrel_to_abs_bbox(org, rel)Takes a rectangle org and applies the relative transformation tuple rel. Returns a Makie.BBox.
UnfoldMakie.to_positions — Functiontopositions(x,y,z;sphere=[0,0,0.]) topositions(pos::AbstractMatrix;sphere=[0,0,0.]) Projects 3D electrode positions to a 2D layout.
The matrix case, assumes size(pos) = (3,nChannels) Re-implementation of the MNE algorithm.
Tipp: You can directly get positions from an MNE object after loading PyMNE and thus activating the UnfoldMakie PyMNE extension
UnfoldMakie.df_timebin — Functiondf_timebin(df, Δbin; col_y=:erp, fun=mean, grouping=[])Split or combine dataframe according to equally spaced time bins
dfAbstractTable with columns:timeandcol_y(default:erp), and all columns ingrouping;Δbinbin size in:timeunits;col_ydefault :erp, the column to combine over (withfun);funfunction to combine, default ismean;grouping(vector of symbols/strings) default empty vector, columns to group the data by before aggregating. Values ofnothingare ignored.
UnfoldMakie.cart3d_to_spherical — Functionconvert x/y/z electrode montage positions to spherical coordinate representation. output is a matrixUnfoldMakie.valType_to_symbol — FunctionVal{:bu}() to => :bu