UnfoldMakie.cart3d_to_spherical
— Methodconvert x/y/z electrode montage positions to spherical coordinate representation. output is a matrix
UnfoldMakie.config_kwargs!
— MethodTakes a kwargs named tuple of Key => NamedTuple and merges the fields with the defaults
UnfoldMakie.df_timebin
— Methodfunction dftimebin(df, Δbin; coly=:erp, fun=mean, grouping=[]) Split or combine dataframe according to equally spaced time bins
df
AbstractTable with columns:time
andcol_y
(default:erp
), and all columns ingrouping
;Δbin
bin size in:time
units;col_y
default :erp, the column to combine over (withfun
);fun
function to combine, default ismean
;grouping
(vector of symbols/strings) default empty vector, columns to group the data by before aggregating. Values ofnothing
are ignored.
UnfoldMakie.eeg_matrix_to_dataframe
— MethodHelper function converting a matrix (channel x times) to a tidy dataframe with columns :estimate, :time and :label
UnfoldMakie.eeg_topoplot_series!
— Methodeegtopoplotseries!(fig, data::DataFrame, Δbin; kwargs..) In place plotting of topoplot series see eegtopoplotseries(data, Δbin) for help
UnfoldMakie.eeg_topoplot_series
— Methodfunction 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
data
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 in
:time
units, 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
col
androw
arguments 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 in df.condition) rows of topoplot series.
- The
figure
option allows you to include information for plotting the figure. Alternatively, you can pass a fig objecteeg_topoplot_series!(fig, data::DataFrame, Δbin; kwargs..)
. row_labels
andcol_labels
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).
Examples
Desc
julia > df = DataFrame(:erp => repeat(1:63, 100), :time => repeat(1:20, 5 * 63), :label => repeat(1:63, 100)) # fake data
+API · UnfoldMakie.jl UnfoldMakie.cart3d_to_spherical
— Methodconvert x/y/z electrode montage positions to spherical coordinate representation. output is a matrix
sourceUnfoldMakie.config_kwargs!
— MethodTakes a kwargs named tuple of Key => NamedTuple and merges the fields with the defaults
sourceUnfoldMakie.df_timebin
— Methodfunction dftimebin(df, Δbin; coly=:erp, fun=mean, grouping=[]) Split or combine dataframe according to equally spaced time bins
df
AbstractTable with columns :time
and col_y
(default :erp
), and all columns in grouping
;Δbin
bin size in :time
units;col_y
default :erp, the column to combine over (with fun
);fun
function to combine, default is mean
;grouping
(vector of symbols/strings) default empty vector, columns to group the data by before aggregating. Values of nothing
are ignored.
sourceUnfoldMakie.eeg_matrix_to_dataframe
— MethodHelper function converting a matrix (channel x times) to a tidy dataframe with columns :estimate, :time and :label
sourceUnfoldMakie.eeg_topoplot_series!
— Methodeegtopoplotseries!(fig, data::DataFrame, Δbin; kwargs..) In place plotting of topoplot series see eegtopoplotseries(data, Δbin) for help
sourceUnfoldMakie.eeg_topoplot_series
— Methodfunction 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
data
needs the columns :time
and y(=:erp)
, and label(=:label)
. If data
is a matrix, it is automatically cast to a dataframe, time bins are in samples, labels are string.(1:size(data,1))
. - Δbin in
:time
units, 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 with positions=pos
. - The
col
and row
arguments specify the field to be divided into columns and rows. The default is col=:time
to split by the time field and row=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
figure
option allows you to include information for plotting the figure. Alternatively, you can pass a fig object eeg_topoplot_series!(fig, data::DataFrame, Δbin; kwargs..)
. row_labels
and col_labels
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).
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)
sourceUnfoldMakie.plot_butterfly
— MethodPlot Butterfly
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = NamedTuple() - use kwargs...
of Makie.Axis
layout = (showLegend = false, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t))
mapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:channel, :channels, :trial, :trials), positions = (:pos, :positions, :position, :topoPositions, :x, nothing), labels = (:labels, :label, :topoLabels, :sensor, nothing))
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 AlgebraOfGraphics.colobar!
key-word arguments
topomarkersize
(Real, 10
) - change the size of the markers, topoplot-inlay electrodestopowidth
(Real, 0.25
) - change the size of the inlay topoplot widthtopoheigth
(Real, 0.25
) - change the size of the inlay topoplot height
see also plot_erp
sourceUnfoldMakie.plot_circulareegtopoplot
— Methodplot_circulareegtopoplot(plotData::DataFrame;kwargs...)
-plot_circulareegtopoplot!(figlike, plotData::DataFrame;kwargs...)
Plot a circular EEG topoplot.
Arguments:
figlike::Union{GridPosition, Figure}
: Figure or GridPosition that the plot should be drawn into
plotData::DataFrame
: Dataframe with keys for data (looks for :y,:yhat, :estimate
, and :position (looks for :pos, :positions, :position
),
predictor
(optional; default :predictor) the circular predictor value, defines position of topoplot, is mapped around predictorBounds
predictorBounds
: Default: [0,360]
- The bounds of the predictor. This is relevant for the axis labels.
centerlabel
: default "", the text in the center of the cricle
positions
(nothing) - positions for the plot_topoplot
labels
(nothing) - labels for the plot_topoplot
kwargs...
: Additional styling behavior, see below.
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (aspect = Makie.DataAspect(), label = "") - use kwargs...
of Makie.Axis
layout = (showLegend = false, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ())
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), labelscatter = true, labeltext = true, boundinggeometry = GeometryBasics.Circle) - *use kwargs...
of [``Topoplot.eegtopoplot``](@ref)*
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, label = "Voltage [µV]", colormap = Makie.Reverse{Symbol}(:RdBu)) - use kwargs...
of Makie.Colorbar
Return Value:
A figure containing the circular topoplot at given layout position
sourceUnfoldMakie.plot_designmatrix
— Methodplot_designmatrix(plotData::Unfold.DesignMatrix;kwargs...)
Plot a designmatrix.
Arguments:
plotData::Unfold.DesignMatrix
: Data for the plot visualization.
kwargs
standardizeData
: (bool,true
) - Indicating whether the data is standardized by pointwise division of the data with its sampled standard deviation.sortData
: (bool, true
) - Indicating whether the data is sorted; using sortslices() of Base Julia. xTicks
: (nothing
)
Indicating the number of labels on the x-axis. Behavior if specified in configuration:
- 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=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (xticklabelrotation = 0.39269908169872414,) - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = 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) - use kwargs...
of Makie.Colorbar
Return Value:
A figure displaying the designmatrix.
sourceUnfoldMakie.plot_erp
— Methodplot_erp!(f::Union{GridPosition, Figure}, plotData::DataFrame; kwargs...)
-plot_erp(plotData::DataFrame; kwargs...)
Plot an ERP plot.
Arguments:
f::Union{GridPosition, Figure}
: Figure or GridPosition that the plot should be drawn intoplotData::DataFrame
: Data for the line plot visualization.kwargs...
: Additional styling behavior. Often used: plot_erp(df; mapping=(; color=:coefname, col=:conditionA))
kwargs (...; ...):
categoricalColor
(bool, true
) - Indicates whether the column referenced in mapping.color should be used nonnumerically.categoricalGroup
(bool, true
) - Indicates whether the column referenced in mapping.group should be used nonnumerically.topoLegend
(bool, false
) - Indicating whether a topo plot is used as a legend.stderror
(bool, false
) - Indicating whether the plot should show a colored band showing lower and higher estimates based on the stderror. pvalue
(Array, []
) - example: DataFrame(from=[0.1,0.3], to=[0.5,0.7], coefname=["(Intercept)", "condition:face"])
- if coefname not specified, the lines will be black
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = NamedTuple() - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t))
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) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs...
of AlgebraOfGraphics.colobar!
Return Value:
- f - Figure() or the inputed
f
sourceUnfoldMakie.plot_new
— Methodplot_new() -> String
-
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = NamedTuple() - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t))
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) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs...
of AlgebraOfGraphics.colobar!
sourceUnfoldMakie.plot_parallelcoordinates
— Methodplot_parallelcoordinates!(f::Union{GridPosition, Figure}, plotData::DataFrame, config::PlotConfig; channels::Vector{Int64})
Plot a PCP (parallel coordinates plot).
Arguments:
f::Union{GridPosition, Figure}
: Figure or GridPosition that the plot should be drawn intoplotData::DataFrame
: Data for the plot visualization.config::PlotConfig
: Instance of PlotConfig being applied to the visualization.channels::Vector{Int64}
: vector with all the channels representing an axis used in the PCP in given order.
PCP has problems with size changes of the view window. By adapting the padding, aspect ratio and tick label size in px for a new use case, the PCP can even be added into a Coordinated Multiple Views System
pc_aspect_ratio
Default : 0.55
pc_right_padding
Default : 15
pc_left_padding
Default : 25
pc_top_padding
Default : 26
pc_bottom_padding
Default : 16
pc_tick_label_size
Default : 14
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = NamedTuple() - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :channel, ylabelFromMapping = :y, useColorbar = false, hidespines = (), hidedecorations = (label = false,))
mapping = (x = (:time,), y = (:estimate, :yhat, :y), channel = :channel, category = :category, time = :time)
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:
The input f
sourceUnfoldMakie.plot_topoplot
— Methodplot_topoplot!(f::Union{GridPosition, Figure}, plotData, ; positions=nothing, labels=nothing,kwargs...)
-plot_topoplot(plotData,; positions=nothing, labels=nothing,kwargs...)
Plot a topo plot.
Arguments:
f::Union{GridPosition, Figure}
: Figure or GridPosition (e.g. f[2, 3]) that the plot should be drawn into. New axis is created.plotData::Union{DataFrame, Vector{Float32}}
: Data for the plot visualization.positions::Vector{Point{2, Float32}}=nothing
: positions used if plotData
is no DataFrame. If this is the case and positions=nothing
then positions is generated from labels
.labels::Vector{String}=nothing
: labels used if plotData
is no DataFrame.
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (aspect = Makie.DataAspect(),) - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ())
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), labelscatter = true, labeltext = true, boundinggeometry = GeometryBasics.Circle) - *use kwargs...
of [``Topoplot.eegtopoplot``](@ref)*
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:
A figure displaying the topo plot.
sourceUnfoldMakie.plot_topoplotseries
— Methodplot_topoplotseries!(f::Union{GridPosition, Figure}, plotData::DataFrame,Δbin::Real;kwargs...)
-plot_topoplotseries!(plotData::DataFrame, Δbin::Real;kwargs...)
Plot a Topoplot Series.
Arguments:
f::Union{GridPosition, Figure}
: Figure or GridPosition that the plot should be drawn intoplotData::DataFrame
: DataFrame with data, needs a time
columnΔbin::Real
: A number for how large one bin should be. Δbin is in units of the plotData.time
columncombinefun
(default mean
) can be used to specify how the samples within Δbin
are combined.rasterize_heatmaps
(deault true
) - enforce rasterization of the plot heatmap when saving in svg format.
This has the benefit that all lines/points are vectors, except the interpolated heatmap. This is typically what you want, because else you get ~500x500 vectors per topoplot, which makes everything super slow.
col_labels
, row_labels
- shows column and row labels.
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (aspect = Makie.DataAspect(),) - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ())
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), labelscatter = true, labeltext = false, boundinggeometry = GeometryBasics.Circle) - *use kwargs...
of [``Topoplot.eegtopoplot``](@ref)*
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:
The input f
sourceUnfoldMakie.rel_to_abs_bbox
— Methodreltoabs_bbox(org,rel)
Takes a rectangle org
and applies the relative transformation tuple rel
Returns a Makie.BBox
sourceUnfoldMakie.to_positions
— Methodtopositions(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
sourceUnfoldMakie.valType_to_symbol
— MethodVal{:bu}() to => :bu
sourceInternally, we use a PlotConfig
struct to keep track of common plot options, in order to have a similar API to all functions
UnfoldMakie.PlotConfig
— TypePlotConfig(<plotname>)
-holds various different fields, that can modify various different plotting aspects.
sourceSettings
This document was generated with Documenter.jl version 1.1.2 on Wednesday 8 November 2023. Using Julia version 1.9.3.
+julia > eeg_topoplot_series(df, 5; positions=pos)
UnfoldMakie.plot_butterfly
— MethodPlot Butterfly
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = NamedTuple() - use kwargs...
of Makie.Axis
layout = (showLegend = false, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t))
mapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:channel, :channels, :trial, :trials), positions = (:pos, :positions, :position, :topoPositions, :x, nothing), labels = (:labels, :label, :topoLabels, :sensor, nothing))
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 AlgebraOfGraphics.colobar!
key-word arguments
topomarkersize
(Real,10
) - change the size of the markers, topoplot-inlay electrodestopowidth
(Real,0.25
) - change the size of the inlay topoplot widthtopoheigth
(Real,0.25
) - change the size of the inlay topoplot height
see also plot_erp
UnfoldMakie.plot_circulareegtopoplot
— Methodplot_circulareegtopoplot(plotData::DataFrame;kwargs...)
+plot_circulareegtopoplot!(figlike, plotData::DataFrame;kwargs...)
Plot a circular EEG topoplot.
Arguments:
figlike::Union{GridPosition, Figure}
: Figure or GridPosition that the plot should be drawn intoplotData::DataFrame
: Dataframe with keys for data (looks for:y,:yhat, :estimate
, and :position (looks for:pos, :positions, :position
),predictor
(optional; default :predictor) the circular predictor value, defines position of topoplot, is mapped aroundpredictorBounds
predictorBounds
: Default:[0,360]
- The bounds of the predictor. This is relevant for the axis labels.centerlabel
: default "", the text in the center of the criclepositions
(nothing) - positions for theplot_topoplot
labels
(nothing) - labels for theplot_topoplot
kwargs...
: Additional styling behavior, see below.
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (aspect = Makie.DataAspect(), label = "") - use kwargs...
of Makie.Axis
layout = (showLegend = false, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ())
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), labelscatter = true, labeltext = true, boundinggeometry = GeometryBasics.Circle) - *use kwargs...
of [``Topoplot.eegtopoplot``](@ref)*
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, label = "Voltage [µV]", colormap = Makie.Reverse{Symbol}(:RdBu)) - use kwargs...
of Makie.Colorbar
Return Value:
A figure containing the circular topoplot at given layout position
UnfoldMakie.plot_designmatrix
— Methodplot_designmatrix(plotData::Unfold.DesignMatrix;kwargs...)
Plot a designmatrix.
Arguments:
plotData::Unfold.DesignMatrix
: Data for the plot visualization.
kwargs
standardizeData
: (bool,true
) - Indicating whether the data is standardized by pointwise division of the data with its sampled standard deviation.sortData
: (bool,true
) - Indicating whether the data is sorted; using sortslices() of Base Julia.xTicks
: (nothing
)
Indicating the number of labels on the x-axis. Behavior if specified in configuration:
- 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=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (xticklabelrotation = 0.39269908169872414,) - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = 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) - use kwargs...
of Makie.Colorbar
Return Value:
A figure displaying the designmatrix.
UnfoldMakie.plot_erp
— Methodplot_erp!(f::Union{GridPosition, Figure}, plotData::DataFrame; kwargs...)
+plot_erp(plotData::DataFrame; kwargs...)
Plot an ERP plot.
Arguments:
f::Union{GridPosition, Figure}
: Figure or GridPosition that the plot should be drawn intoplotData::DataFrame
: Data for the line plot visualization.kwargs...
: Additional styling behavior. Often used:plot_erp(df; mapping=(; color=:coefname, col=:conditionA))
kwargs (...; ...):
categoricalColor
(bool,true
) - Indicates whether the column referenced in mapping.color should be used nonnumerically.categoricalGroup
(bool,true
) - Indicates whether the column referenced in mapping.group should be used nonnumerically.topoLegend
(bool,false
) - Indicating whether a topo plot is used as a legend.stderror
(bool,false
) - Indicating whether the plot should show a colored band showing lower and higher estimates based on the stderror.pvalue
(Array,[]
) - example:DataFrame(from=[0.1,0.3], to=[0.5,0.7], coefname=["(Intercept)", "condition:face"])
- if coefname not specified, the lines will be black
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = NamedTuple() - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t))
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) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs...
of AlgebraOfGraphics.colobar!
Return Value:
- f - Figure() or the inputed
f
UnfoldMakie.plot_new
— Methodplot_new() -> String
+
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = NamedTuple() - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t))
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) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs...
of AlgebraOfGraphics.colobar!
UnfoldMakie.plot_parallelcoordinates
— Methodplot_parallelcoordinates!(f::Union{GridPosition, Figure}, plotData::DataFrame, config::PlotConfig; channels::Vector{Int64})
Plot a PCP (parallel coordinates plot).
Arguments:
f::Union{GridPosition, Figure}
: Figure or GridPosition that the plot should be drawn intoplotData::DataFrame
: Data for the plot visualization.config::PlotConfig
: Instance of PlotConfig being applied to the visualization.channels::Vector{Int64}
: vector with all the channels representing an axis used in the PCP in given order.
PCP has problems with size changes of the view window. By adapting the padding, aspect ratio and tick label size in px for a new use case, the PCP can even be added into a Coordinated Multiple Views System
pc_aspect_ratio
Default : 0.55
pc_right_padding
Default : 15
pc_left_padding
Default : 25
pc_top_padding
Default : 26
pc_bottom_padding
Default : 16
pc_tick_label_size
Default : 14
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = NamedTuple() - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :channel, ylabelFromMapping = :y, useColorbar = false, hidespines = (), hidedecorations = (label = false,))
mapping = (x = (:time,), y = (:estimate, :yhat, :y), channel = :channel, category = :category, time = :time)
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:
The input f
UnfoldMakie.plot_topoplot
— Methodplot_topoplot!(f::Union{GridPosition, Figure}, plotData, ; positions=nothing, labels=nothing,kwargs...)
+plot_topoplot(plotData,; positions=nothing, labels=nothing,kwargs...)
Plot a topo plot.
Arguments:
f::Union{GridPosition, Figure}
: Figure or GridPosition (e.g. f[2, 3]) that the plot should be drawn into. New axis is created.plotData::Union{DataFrame, Vector{Float32}}
: Data for the plot visualization.positions::Vector{Point{2, Float32}}=nothing
: positions used ifplotData
is no DataFrame. If this is the case andpositions=nothing
then positions is generated fromlabels
.labels::Vector{String}=nothing
: labels used ifplotData
is no DataFrame.
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (aspect = Makie.DataAspect(),) - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ())
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), labelscatter = true, labeltext = true, boundinggeometry = GeometryBasics.Circle) - *use kwargs...
of [``Topoplot.eegtopoplot``](@ref)*
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:
A figure displaying the topo plot.
UnfoldMakie.plot_topoplotseries
— Methodplot_topoplotseries!(f::Union{GridPosition, Figure}, plotData::DataFrame,Δbin::Real;kwargs...)
+plot_topoplotseries!(plotData::DataFrame, Δbin::Real;kwargs...)
Multiple miniature topoplots in regular distances
Arguments:
f::Union{GridPosition, Figure}
: Figure or GridPosition that the plot should be drawn intoplotData::DataFrame
: DataFrame with data, needs atime
columnΔbin::Real
: A number for how large one bin should be. Δbin is in units of theplotData.time
columncombinefun
(defaultmean
) can be used to specify how the samples withinΔbin
are combined.rasterize_heatmaps
(deaulttrue
) - enforce rasterization of the plot heatmap when saving in svg format.
This has the benefit that all lines/points are vectors, except the interpolated heatmap. This is typically what you want, because else you get ~500x500 vectors per topoplot, which makes everything super slow.
col_labels
,row_labels
- shows column and row labels.
Shared plot configuration options
The shared plot options can be used as follows: type=(;key=value,...))
- for example plot_x(...,layout=(showLegend=true,legendPosition=:right))
. Multiple defaults will be cycled until match.
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (aspect = Makie.DataAspect(),) - use kwargs...
of Makie.Axis
layout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ())
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), labelscatter = true, labeltext = false, boundinggeometry = GeometryBasics.Circle) - *use kwargs...
of [``Topoplot.eegtopoplot``](@ref)*
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:
The input f
UnfoldMakie.rel_to_abs_bbox
— Methodreltoabs_bbox(org,rel)
Takes a rectangle org
and applies the relative transformation tuple rel
Returns a Makie.BBox
UnfoldMakie.to_positions
— Methodtopositions(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.valType_to_symbol
— MethodVal{:bu}() to => :bu
Internally, we use a PlotConfig
struct to keep track of common plot options, in order to have a similar API to all functions
UnfoldMakie.PlotConfig
— TypePlotConfig(<plotname>)
+holds various different fields, that can modify various different plotting aspects.