UnfoldMakie.cart3d_to_spherical
— Methodcart3d_to_spherical(x, y, z)
Convert x, y, z electrode positions on a scalp to spherical coordinate representation.
Return Value: Matrix
.
UnfoldMakie.config_kwargs!
— Methodconfig_kwargs!(cfg::PlotConfig; kwargs...)
Takes named tuple of Key => NamedTuple
as kwargs and merges the fields with the defaults.
UnfoldMakie.df_timebin
— Methoddf_timebin(df, Δbin; col_y = :erp, fun = mean, grouping = [])
Split or combine DataFrame
according to equally spaced time bins.
Arguments:
df::AbstractTable
With columns:time
andcol_y
(default:erp
), and all columns ingrouping
;Δbin
Bin size in:time
units;col_y = :erp
The column to combine over (withfun
);fun = mean()
Function to combine.grouping = []
Vector of symbols or strings, columns to group the data by before aggregation. Values ofnothing
are ignored.
Return Value: DataFrame
.
UnfoldMakie.eeg_matrix_to_dataframe
— Methodeeg_matrix_to_dataframe(data::Matrix, label)
Helper function converting a matrix (channel x times) to a tidy DataFrame
with columns :estimate
, :time
and :label
.
Return Value: DataFrame
.
UnfoldMakie.eeg_topoplot_series
— Methodeeg_topoplot_series(data::DataFrame,
fig,
data::DataFrame,
Δbin;
y = :erp,
label = :label,
col = :time,
row = nothing,
col_labels = false,
row_labels = false,
rasterize_heatmaps = true,
combinefun = mean,
xlim_topo,
ylim_topo,
topoplot_attributes...,
)
eeg_topoplot_series!(fig, data::DataFrame, Δbin; kwargs..)
Plot a series of topoplots. The function automatically takes the combinefun = mean
over the :time
column of data
in Δbin
steps.
fig
Figure object.data::DataFrame
Needs the columns:time
andy(=:erp)
, andlabel(=:label)
.
Ifdata
is a matrix, it is automatically cast to a dataframe, time bins are in samples, labels arestring.(1:size(data,1))
.Δbin = :time
In:time
units, specifying the time steps. All other keyword arguments are passed to theEEG_TopoPlot
recipe.
In most cases, the user should specify the electrode positions withpositions = pos
.col
,row = :time
Specify the field to be divided into columns and rows. The default iscol=:time
to 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 indf.condition
) rows of topoplot series.row_labels
,col_labels = false
Indicate 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).
Example
df = DataFrame(:erp => repeat(1:63, 100), :time => repeat(1:20, 5 * 63), :label => repeat(1:63, 100)) # simulated data
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 # simulated electrode positions
pos = [Point2.(pos[k, 1], pos[k, 2]) for k in 1:size(pos, 1)]
eeg_topoplot_series(df, 5; positions = pos)
Return Value: Tuple{Figure, Vector{Any}}
.
UnfoldMakie.plot_butterfly
— Methodplot_butterfly(plot_data::DataFrame; positions = nothing)
Plot a Butterfly plot.
Keyword argumets (kwargs)
positions::Array = []
Adds a topoplot as an inset legend to the provided channel positions. Must be the same length asplot_data
. To change the colors of the channel lines use thetopoposition_to_color
function.topolegend::Bool = true
Show an inlay topoplot with corresponding electrodes. Requirespositions
.topomarkersize::Real = 10
Change the size of the electrode markers in topoplot.topowidth::Real = 0.25
Change the width of inlay topoplot.topoheigth::Real = 0.25
Change the height of inlay topoplot.topopositions_to_color::x -> posToColorRomaO(x)
Change the line colors.
Return Value: Figure
displaying Butterfly plot.
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 = "Voltage [µV]", yticklabelsize = 14) - use kwargs...
of Makie.Axis
layout = (show_legend = false, legend_position = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, use_colorbar = false, hidespines = (:r, :t), hidedecorations = Dict{Symbol, Bool}(:label => 0, :ticks => 0, :ticklabels => 0))
mapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:channel, :channels, :trial, :trials), positions = (:pos, :positions, :position, :topo_positions, :x, nothing), labels = (:labels, :label, :topoLabels, :sensor, nothing), group = (:channel,))
visual = (colormap = nothing, color = nothing) - use kwargs...
of Makie.lines
legend = (orientation = :vertical, tellwidth = true, tellheight = false, framevisible = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs...
of AlgebraOfGraphics.colobar!
see also plot_erp
UnfoldMakie.plot_channelimage
— Methodplot_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.
UnfoldMakie.plot_circular_topoplots
— Methodplot_circular_topoplots!(f, data::DataFrame; kwargs...)
plot_circular_topoplots(data::DataFrame; kwargs...)
Plot a circular EEG topoplot.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::DataFrame
DataFrame with data keys (columns:y, :yhat, :estimate
), and :position (columns:pos, :position, :positions
).
Keyword argumets (kwargs)
predictor::Vector{Any} = :predictor
The circular predictor value, defines position of topoplot across the circle. Mapped aroundpredictor_bounds
.predictor_bounds::Vector{Int64} = [0, 360]
The bounds of the predictor. Relevant for the axis labels.positions::Vector{Point{2, Float32}} = nothing
Positions of theplot_topoplot
.center_label::String = ""
The text in the center of the cricle.labels::Vector{String} = nothing
Labels for theplot_topoplot
.
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 = "", aspect = Makie.DataAspect(), label = "") - use kwargs...
of Makie.Axis
layout = (show_legend = false, legend_position = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, use_colorbar = true, hidespines = (), hidedecorations = Dict{Symbol, Bool}(:label => 0))
mapping = (x = nothing, y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing))
visual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), label_scatter = true, label_text = true, bounding_geometry = GeometryBasics.Circle) - use kwargs...
of Topoplot.eeg_topoplot
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, flipaxis = true, labelrotation = -1.5707963267948966, label = "Voltage [µV]", colormap = Makie.Reverse{Symbol}(:RdBu)) - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying the Circular topoplot.
UnfoldMakie.plot_designmatrix
— Methodplot_designmatrix!(f::Union{GridPosition, GridLayout, Figure}, data::Unfold.DesignMatrix; kwargs...)
plot_designmatrix(data::Unfold.DesignMatrix; kwargs...)
Plot a designmatrix.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Unfold.DesignMatrix
Data for the plot visualization.
Keyword argumets (kwargs)
standardize_data::Bool = true
Indicates whether the data is standardized by pointwise division of the data with its sampled standard deviation.sort_data::Bool = true
Indicates whether the data is sorted. It usessortslices()
of Base Julia.xticks::Num = nothing
Returns the number of labels on the x axis.xticks
= 0: no labels are placed.xticks
= 1: first possible label is placed.xticks
= 2: first and last possible labels are placed.- 2 <
xticks
<number of labels
: equally distribute the labels. xticks
≥number of labels
: all labels are placed.
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 = "Conditions", ylabel = "Trials", xticklabelrotation = 0.39) - use kwargs...
of Makie.Axis
layout = (show_legend = true, legend_position = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, use_colorbar = true)
mapping = (x = (:time,), y = (:estimate, :yhat, :y))
visual = (colormap = :roma,) - use kwargs...
of Makie.heatmap
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, flipaxis = true, labelrotation = -1.5707963267948966, label = "") - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying the Design matrix.
UnfoldMakie.plot_erp
— Methodplot_erp!(f::Union{GridPosition, GridLayout, Figure}, plot_data::DataFrame; kwargs...)
plot_erp(plot_data::DataFrame; kwargs...)
Plot an ERP plot.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Union{DataFrame, Vector{Float32}}
Data for the Line plot visualization.kwargs...
Additional styling behavior.
Often used as:plot_erp(df; mapping = (; color = :coefname, col = :conditionA))
.
Keyword argumets (kwargs)
categorical_color::Bool = true
Treat:color
as continuous or categorical variable in case of numeric:color
column.categorical_group::Bool = true
Treat:group
as categorical variable by default in case of numeric:group
column.stderror::Bool = false
Add an error ribbon, with lower and upper limits based on the:stderror
column.pvalue::DataFrame = nothing
Show a p-values as a horizontal bars.
Example:DataFrame(from = [0.1, 0.3], to=[0.5, 0.7], coefname=["(Intercept)", "condition:face"])
.
Ifcoefname
is not specified, the significance lines will be black.
Internal use only:
butterfly::Bool = true
A butterfly plot instead of an ERP plot. Seeplot_butterfly
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 = "Voltage [µV]", yticklabelsize = 14) - use kwargs...
of Makie.Axis
layout = (show_legend = true, legend_position = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, use_colorbar = false, hidespines = (:r, :t), hidedecorations = Dict{Symbol, Bool}(:grid => 1, :label => 0, :ticks => 0, :ticklabels => 0))
mapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:color, :coefname, nothing))
visual = (colormap = :roma,) - use kwargs...
of Makie.lines
legend = (orientation = :vertical, tellwidth = true, tellheight = false, framevisible = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs...
of AlgebraOfGraphics.colobar!
Return Value: Figure
displaying the ERP plot.
UnfoldMakie.plot_erpgrid
— Methodplot_erpgrid!(f::Union{GridPosition, GridLayout, Figure}, data::Matrix{<:Real}, pos::Vector{Point{2,Float}}; kwargs...)
plot_erpgrid(data::Matrix{<:Real}, pos::Vector{Point{2,Float}}; kwargs...)
Plot an ERP image.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Matrix{<:Real}
Data for the plot visualization.pos::Vector{Point{2,Float}}
Electrode positions.
Keyword argumets (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(...; 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 = "Voltage [µV]", xlim = [-0.04, 1.0], ylim = [-0.04, 1.0]) - 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 = :roma,) - use kwargs...
of Makie.lines
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying ERP grid.
UnfoldMakie.plot_erpimage
— Methodplot_erpimage!(f::Union{GridPosition, GridLayout, Figure}, data::Matrix{Float64}; kwargs...)
plot_erpimage(data::Matrix{Float64}; kwargs...)
Plot an ERP image.
Arguments:
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Union{DataFrame, Vector{Float32}}
Data for the plot visualization.
Keyword argumets (kwargs)
erpblur::Number = 10
Number indicating how much blur is applied to the image.
Gaussian blur of theImageFiltering
module is used.
Non-Positive values deactivate the blur.sortvalues::Vector{Int64} = false
Parameter over which plot will be sorted. Usingsortperm()
of Base Julia.\sortperm()
computes a permutation of the array's indices that puts the array in sorted order.sortindex::Vector{Int64} = nothing
Sorting over index values.meanplot::bool = false
Add a line plot below the ERP image, showing the mean of the data.show_sortval::bool = false
Add a plot below the ERP image, showing the distribution of the sorting data.axis.ylabel::String = "Trials"
Ifsortvalues = true
the default text will change to "Sorted trials", but it could be changed to any values specified manually.
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 = "Trials") - use kwargs...
of Makie.Axis
layout = (show_legend = true, legend_position = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, use_colorbar = true)
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 ERP image.
UnfoldMakie.plot_parallelcoordinates
— Methodplot_parallelcoordinates(f::Union{GridPosition, GridLayout, Figure}, data::DataFrame; kwargs)
Plot a PCP (parallel coordinates plot).
Arguments:
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Union{DataFrame, Vector{Float32}}
Data for the plot visualization.
Keyword argumets (kwargs)
normalize::Symbol = nothing
If:minmax
, normalize each axis to their respective min-max range.ax_labels::Vector{String} = nothing
Specify axis labels.
Should be a vector of labels with length equal to the number of uniquemapping.x
values.
Example:ax_labels = ["Fz", "Cz", "O1", "O2"]
.ax_ticklabels::Symbol = :outmost
Specify tick labels on axis.:all
- show all labels on all axes.:left
- show all labels on the left axis, but only min and max on others.:outmost
- show labels on min and max of all other axes.:none
- remove all labels.
bend::Bool = false
Change straight lines between the axes to curved ("bent") lines using spline interpolation.
Note: While this makes the plot look cool, it is not generally recommended to bent the lines, as interpretation suffers, and the resulting visualizations can be potentially missleading.visual.alpha::Number = 0.5
Change of line transparency.
Defining the axes
mapping.x = :channel, mapping.y = :estimate
.
Overwrite what should be on the x and the y axes.mapping.color = :colorcolumn
Split conditions by color. The default color is:black
.
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 = (ylabel = "Time", title = "") - use kwargs...
of Makie.Axis
layout = (show_legend = true, legend_position = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, use_colorbar = false)
mapping = (x = :channel, y = (:estimate, :yhat, :y))
visual = (colormap = ColorTypes.RGBA{Float32}[RGBA{Float32}(0.0f0,0.44705883f0,0.69803923f0,1.0f0), RGBA{Float32}(0.9019608f0,0.62352943f0,0.0f0,1.0f0), RGBA{Float32}(0.0f0,0.61960787f0,0.4509804f0,1.0f0), RGBA{Float32}(0.8f0,0.4745098f0,0.654902f0,1.0f0), RGBA{Float32}(0.3372549f0,0.7058824f0,0.9137255f0,1.0f0), RGBA{Float32}(0.8352941f0,0.36862746f0,0.0f0,1.0f0), RGBA{Float32}(0.9411765f0,0.89411765f0,0.25882354f0,1.0f0)], color = :black, alpha = 0.3) - use kwargs...
of Makie.lines
legend = (orientation = :vertical, tellwidth = true, tellheight = false, title = "Conditions", merge = true, framevisible = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying the Parallel coordinates plot.
UnfoldMakie.plot_topoplot
— Methodplot_topoplot!(f::Union{GridPosition, GridLayout, Figure}, data, ; positions = nothing, labels = nothing, kwargs...)
plot_topoplot(data; positions = nothing, labels = nothing, kwargs...)
Plot a topoplot.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Union{DataFrame, Vector{Float32}}
Data for the plot visualization.positions::Vector{Point{2, Float32}} = nothing
Positions used ifdata
is not aDataFrame
. Positions are generated fromlabels
ifpositions = nothing
.labels::Vector{String} = nothing
Labels used ifdata
is not a DataFrame.
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 = "", aspect = Makie.DataAspect()) - use kwargs...
of Makie.Axis
layout = (show_legend = true, legend_position = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, use_colorbar = true, hidespines = (), hidedecorations = Dict{Symbol, Bool}(:label => 0))
mapping = (x = nothing, y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing))
visual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), label_scatter = true, label_text = true, bounding_geometry = GeometryBasics.Circle) - use kwargs...
of Topoplot.eeg_topoplot
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, flipaxis = true, labelrotation = -1.5707963267948966, label = "Voltage [µV]") - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying the Topoplot.
UnfoldMakie.plot_topoplotseries
— Methodplot_topoplotseries(f::Union{GridPosition, GridLayout, Figure}, data::DataFrame, Δbin::Real; kwargs...)
plot_topoplotseries!(data::DataFrame, Δbin::Real; kwargs...)
Multiple miniature topoplots in regular distances.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Union{DataFrame, Vector{Float32}}
DataFrame with data. Requires atime
column.Δbin::Real
A number for how large one time bin should be.
Δbin
is in units of thedata.time
column.
Keyword arguments (kwargs)
combinefun::Function = mean
Specify how the samples withinΔbin
are summarised.
Example functions:mean
,median
,std
.rasterize_heatmaps::Bool = true
Force rasterization of the plot heatmap when saving insvg
format.
Except for the interpolated heatmap, all lines/points are vectors.
This is typically what you want, otherwise you get ~128x128 vectors per topoplot, which makes everything super slow.col_labels::Bool
,row_labels::Bool = true
Shows column and row labels.labels::Vector{String} = nothing
Show labels for each electrode.positions::Vector{Point{2, Float32}} = nothing
Specify channel positions. Requires the list of x and y positions for all unique electrode.
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 windows [s]", aspect = Makie.DataAspect(), title = "", titlesize = 16, titlefont = :bold, ylabel = "", xlim_topo = (-0.25, 1.25), ylim_topo = (-0.25, 1.25), ylabelpadding = 25, xlabelpadding = 25) - use kwargs...
of Makie.Axis
layout = (show_legend = true, legend_position = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, use_colorbar = true, hidespines = (), hidedecorations = Dict{Symbol, Bool}(:label => 0))
mapping = (x = nothing, y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing), col = (:time,), row = (nothing,))
visual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), label_scatter = false, label_text = false, bounding_geometry = GeometryBasics.Circle, enlarge = 1) - use kwargs...
of Topoplot.eeg_topoplot
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, flipaxis = true, labelrotation = -1.5707963267948966, label = "Voltage [µV]", colorrange = nothing) - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying the Topoplot series.
UnfoldMakie.rel_to_abs_bbox
— Methodrel_to_abs_bbox(org, rel)
Takes a rectangle org
and applies the relative transformation tuple rel
.
Return Value: Makie.BBox
.
UnfoldMakie.to_positions
— Methodto_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}}
.
Internally, we use a PlotConfig
struct to keep track of common plotting options, so that all functions have a similar API.
UnfoldMakie.PlotConfig
— TypePlotConfig(<plotname>)
Contains several different fields that can modify various aspects of the plot.
UnfoldMakie.PCPTicks
— TypePCPTicks
Used to inject extrema ticks and round them if necessary.