diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 4c02f2aaa..e46e3d63d 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-11-08T22:43:27","documenter_version":"1.1.2"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.3","generation_timestamp":"2023-11-10T16:21:32","documenter_version":"1.1.2"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 8c5e5b3a6..c3c1c3146 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,11 +1,11 @@ -API · UnfoldMakie.jl
UnfoldMakie.df_timebinMethod

function 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.
source
UnfoldMakie.eeg_topoplot_seriesMethod

function 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
+API · UnfoldMakie.jl
UnfoldMakie.df_timebinMethod

function 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.
source
UnfoldMakie.eeg_topoplot_seriesMethod

function 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)
source
UnfoldMakie.plot_butterflyMethod

Plot 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 electrodes
  • topowidth (Real, 0.25) - change the size of the inlay topoplot width
  • topoheigth (Real, 0.25) - change the size of the inlay topoplot height

see also plot_erp

source
UnfoldMakie.plot_circulareegtopoplotMethod
plot_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

source
UnfoldMakie.plot_designmatrixMethod
plot_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.

source
UnfoldMakie.plot_erpMethod
plot_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 into
  • plotData::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
source
UnfoldMakie.plot_newMethod
plot_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!

source
UnfoldMakie.plot_parallelcoordinatesMethod
plot_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 into
  • plotData::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

source
UnfoldMakie.plot_topoplotMethod
plot_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.

source
UnfoldMakie.plot_topoplotseriesMethod
plot_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 into
  • plotData::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 column
  • combinefun (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

source
UnfoldMakie.to_positionsMethod

topositions(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

source

Internally, we use a PlotConfig struct to keep track of common plot options, in order to have a similar API to all functions

UnfoldMakie.PlotConfigType
PlotConfig(<plotname>)
-holds various different fields, that can modify various different plotting aspects.
source
+julia > eeg_topoplot_series(df, 5; positions=pos)
source
UnfoldMakie.plot_butterflyMethod

Plot 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 electrodes
  • topowidth (Real, 0.25) - change the size of the inlay topoplot width
  • topoheigth (Real, 0.25) - change the size of the inlay topoplot height

see also plot_erp

source
UnfoldMakie.plot_circulareegtopoplotMethod
plot_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

source
UnfoldMakie.plot_designmatrixMethod
plot_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.

source
UnfoldMakie.plot_erpMethod
plot_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 into
  • plotData::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
source
UnfoldMakie.plot_newMethod
plot_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!

source
UnfoldMakie.plot_parallelcoordinatesMethod
plot_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 into
  • plotData::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

source
UnfoldMakie.plot_topoplotMethod
plot_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.

source
UnfoldMakie.plot_topoplotseriesMethod
plot_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 into
  • plotData::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 column
  • combinefun (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

source
UnfoldMakie.to_positionsMethod

topositions(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

source

Internally, we use a PlotConfig struct to keep track of common plot options, in order to have a similar API to all functions

UnfoldMakie.PlotConfigType
PlotConfig(<plotname>)
+holds various different fields, that can modify various different plotting aspects.
source
diff --git a/dev/generated/reference/positions/index.html b/dev/generated/reference/positions/index.html index 1d7fce773..00a9a19aa 100644 --- a/dev/generated/reference/positions/index.html +++ b/dev/generated/reference/positions/index.html @@ -39,4 +39,4 @@ f = Figure(resolution=(600,300)) scatter(f[1,1],pos3d[1:2,:]) scatter(f[1,2],pos2) -fExample block output

as one can see, the "naive" transform of just dropping the third dimension doesnt really work (left). We rather have to project the chanels to a sphere and unfold it (right)


This page was generated using Literate.jl.

+fExample block output

as one can see, the "naive" transform of just dropping the third dimension doesnt really work (left). We rather have to project the chanels to a sphere and unfold it (right)


This page was generated using Literate.jl.

diff --git a/dev/generated/tutorials/circTopo/index.html b/dev/generated/tutorials/circTopo/index.html index 230799470..1fd286419 100644 --- a/dev/generated/tutorials/circTopo/index.html +++ b/dev/generated/tutorials/circTopo/index.html @@ -21,4 +21,4 @@ axis = (; label = "Time?!"), predictor = :time, predictorBounds = [80, 320], -)Example block output

This page was generated using Literate.jl.

+)Example block output

This page was generated using Literate.jl.

diff --git a/dev/generated/tutorials/erp/index.html b/dev/generated/tutorials/erp/index.html index 4e42e8215..d77e0feb5 100644 --- a/dev/generated/tutorials/erp/index.html +++ b/dev/generated/tutorials/erp/index.html @@ -30,4 +30,4 @@ # coefname=["(Intercept)","condition: face"] # if coefname not specified, line should be black # )

plot_erp(results; :pvalue=>pvals)

stderror (boolean)

Indicating whether the plot should show a colored band showing lower and higher estimates based on the stderror. Default is false.

previously we showed :stderror- but low/high is possible as well`

results.se_low = results.estimate .- 0.5
 results.se_high = results.estimate .+ 0.15
-plot_erp(select(results, Not(:stderror)); stderror = true)
Example block output
Note

as in the above code,:stderror has precedence over :se_low/:se_high


This page was generated using Literate.jl.

+plot_erp(select(results, Not(:stderror)); stderror = true)Example block output
Note

as in the above code,:stderror has precedence over :se_low/:se_high


This page was generated using Literate.jl.

diff --git a/dev/helper/index.html b/dev/helper/index.html index 1868fbafd..93ebae7fd 100644 --- a/dev/helper/index.html +++ b/dev/helper/index.html @@ -1,5 +1,5 @@ -Utilities · UnfoldMakie.jl
UnfoldMakie.RelativeAxisType

ax = RelativeAxis(figlike, p::NTuple{4, Float64}; kwargs...)

Returns an axis which's position is relative to a GridLayout Element (via BBox) and not relative to the Scene (default Axis(..., bbox=BBox()) behavior)

p::NTuple{4,Float64}: Give the relative position to the GridPosition, left:right; bottom:up, typical numbers betwen 0 and 1. E.g. (0.25, 0.75, 0.25, 0.75) would center an Axis inside that GridPosition

kwargs... are pasted into Axis

f = Figure() ax = RelativeAxis(f[1,2], (0.25, 0.75, 0.25, 0.75)) # returns Axis centered within f[1,2]

source
UnfoldMakie.eeg_topoplot_seriesFunction

function 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
+Utilities · UnfoldMakie.jl
UnfoldMakie.RelativeAxisType

ax = RelativeAxis(figlike, p::NTuple{4, Float64}; kwargs...)

Returns an axis which's position is relative to a GridLayout Element (via BBox) and not relative to the Scene (default Axis(..., bbox=BBox()) behavior)

p::NTuple{4,Float64}: Give the relative position to the GridPosition, left:right; bottom:up, typical numbers betwen 0 and 1. E.g. (0.25, 0.75, 0.25, 0.75) would center an Axis inside that GridPosition

kwargs... are pasted into Axis

f = Figure() ax = RelativeAxis(f[1,2], (0.25, 0.75, 0.25, 0.75)) # returns Axis centered within f[1,2]

source
UnfoldMakie.eeg_topoplot_seriesFunction

function 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)
source
UnfoldMakie.to_positionsFunction

topositions(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

source
UnfoldMakie.df_timebinFunction

function 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.
source
+julia > eeg_topoplot_series(df, 5; positions=pos)
source
UnfoldMakie.to_positionsFunction

topositions(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

source
UnfoldMakie.df_timebinFunction

function 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.
source
diff --git a/dev/how_to/fix_pcp/index.html b/dev/how_to/fix_pcp/index.html index eb96423a8..d82647834 100644 --- a/dev/how_to/fix_pcp/index.html +++ b/dev/how_to/fix_pcp/index.html @@ -8,4 +8,4 @@ pc_bottom_padding = 27, ...

Furthermore, if the tick-number size becomes too big or small it can be changed with:

...
 pc_tick_label_size = 25,
-...

By setting these manually through trial and error we can fix the visualization issues

+...

By setting these manually through trial and error we can fix the visualization issues

diff --git a/dev/how_to/hide_deco/index.html b/dev/how_to/hide_deco/index.html index 78be67c98..a43b4911a 100644 --- a/dev/how_to/hide_deco/index.html +++ b/dev/how_to/hide_deco/index.html @@ -13,4 +13,4 @@ layout=(; hidespines = nothing, hidedecorations = nothing - ),)Example block output + ),)Example block output diff --git a/dev/how_to/mult_vis_in_fig/5bb3b14d.png b/dev/how_to/mult_vis_in_fig/1a9fffd2.png similarity index 87% rename from dev/how_to/mult_vis_in_fig/5bb3b14d.png rename to dev/how_to/mult_vis_in_fig/1a9fffd2.png index d65bae7d5..3bd50aca3 100644 Binary files a/dev/how_to/mult_vis_in_fig/5bb3b14d.png and b/dev/how_to/mult_vis_in_fig/1a9fffd2.png differ diff --git a/dev/how_to/mult_vis_in_fig/index.html b/dev/how_to/mult_vis_in_fig/index.html index ff2354d2e..97ff8cfa3 100644 --- a/dev/how_to/mult_vis_in_fig/index.html +++ b/dev/how_to/mult_vis_in_fig/index.html @@ -56,4 +56,4 @@ plot_circulareegtopoplot!(f[3:4, 4:5], d_topo[in.(d_topo.time, Ref(-0.3:0.1:0.5)), :]; positions=positions, predictor=:time,predictorBounds=[-0.3, 0.5]) -fExample block output +fExample block output diff --git a/dev/how_to/position2color/index.html b/dev/how_to/position2color/index.html index c042ce1b0..fb1a3122b 100644 --- a/dev/how_to/position2color/index.html +++ b/dev/how_to/position2color/index.html @@ -5,4 +5,4 @@ using Colors

By default the plot looks like this:

include("../../example_data.jl")
 results, positions = example_data("TopoPlots.jl")
 plot_butterfly(results; positions=positions)
Example block output

We can switch the colorscale of the position-map, by giving a function that maps from a (x,y) tuple to a color. UnfoldMakie currently provides three different ones pos2colorRGB (same as MNE-Python), pos2colorHSV (HSV colorspace), pos2colorRomaO. Whereas RGB & HSV have the benefits of being 2D colormaps, Roma0 has the benefit of being perceptualy uniform.

Similar to MNE

plot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction = pos -> UnfoldMakie.posToColorRGB(pos)))
Example block output

HSV-Space

plot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction=UnfoldMakie.posToColorHSV))
Example block output

Uniform Color

To highlight the flexibility, we can also make all lines gray, or any other arbitrary color, or function of electrode-position.

using Colors
-plot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction = x -> Colors.RGB(0.5)))
Example block output +plot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction = x -> Colors.RGB(0.5)))Example block output diff --git a/dev/how_to/show_oob_labels/index.html b/dev/how_to/show_oob_labels/index.html index d0462b875..a526809d2 100644 --- a/dev/how_to/show_oob_labels/index.html +++ b/dev/how_to/show_oob_labels/index.html @@ -2,4 +2,4 @@ Show out of Bounds Label · UnfoldMakie.jl

Show out of Bounds Label

When visualizing a design matrix, it can happen that the labels on the y-axis get cut off to the left (especially if they are quite long). In the following, we will discuss a possible quick solution to this problem.

We start with the "label-limited" time-expanded designmatrix from the corresponding Tutorial section, which describes in detail how to generate it.

plot_designmatrix(designmatrix!(ufCont,evts), cDesign; xTicks=10, sortData=false)

While the plot automatically sets its height according to the labels, the labels are cut off on the left side.

A quick fix would be to place an empty plot to the left of the designmatrix.

By creating your own figure with Makie.Figure and then giving the designmatrix only a certain grid position, we get white space next to the plot.

The plot! function inside the plot config instance can take any grid position, and the figure f will contain the plot and enough white space next to it.

The exact numbers in the grid position can be guessed from the overlap ratio, or just tried.

f = Figure()
 plot_design(f[1,2:6], designmatrix!(ufCont, evts), cDesign; setExtraValues=(xTicks=10, sortData=false))
 
-f
+f diff --git a/dev/index.html b/dev/index.html index b2cf88b80..956724c7b 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -UnfoldMakie Documentation · UnfoldMakie.jl

UnfoldMakie Documentation

This is the documentation of the UnfoldMakie module for the Julia programming language.

About

UnfoldMakie aims to allow users to create different types of visualizations. These include line plots, butterfly plots, design matrices, parallel coordinate plots, ERP images, and topo plots. Building on the Unfold and Makie Modules, it also allows users to customize the plots through an input configuration.

As can be seen from the types of visualizations possible, these configuration options try to enable the user to create plots that are helpful in the field of computational EEG. One such example is the ability to use a topo plot as a legend for a line plot by allowing multiple visualizations within a figure.

Coordinated Multiple Views

+UnfoldMakie Documentation · UnfoldMakie.jl

UnfoldMakie Documentation

This is the documentation of the UnfoldMakie module for the Julia programming language.

About

UnfoldMakie aims to allow users to create different types of visualizations. These include line plots, butterfly plots, design matrices, parallel coordinate plots, ERP images, and topo plots. Building on the Unfold and Makie Modules, it also allows users to customize the plots through an input configuration.

As can be seen from the types of visualizations possible, these configuration options try to enable the user to create plots that are helpful in the field of computational EEG. One such example is the ability to use a topo plot as a legend for a line plot by allowing multiple visualizations within a figure.

Coordinated Multiple Views

diff --git a/dev/search_index.js b/dev/search_index.js index f54c14031..ef60b3b3d 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"how_to/show_oob_labels/#ht_soobl","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"","category":"section"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"When visualizing a design matrix, it can happen that the labels on the y-axis get cut off to the left (especially if they are quite long). In the following, we will discuss a possible quick solution to this problem.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"We start with the \"label-limited\" time-expanded designmatrix from the corresponding Tutorial section, which describes in detail how to generate it.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"plot_designmatrix(designmatrix!(ufCont,evts), cDesign; xTicks=10, sortData=false)","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"While the plot automatically sets its height according to the labels, the labels are cut off on the left side.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"A quick fix would be to place an empty plot to the left of the designmatrix.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"By creating your own figure with Makie.Figure and then giving the designmatrix only a certain grid position, we get white space next to the plot.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"The plot! function inside the plot config instance can take any grid position, and the figure f will contain the plot and enough white space next to it.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"The exact numbers in the grid position can be guessed from the overlap ratio, or just tried.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"f = Figure()\nplot_design(f[1,2:6], designmatrix!(ufCont, evts), cDesign; setExtraValues=(xTicks=10, sortData=false))\n\nf","category":"page"},{"location":"how_to/position2color/#ht_p2c","page":"Butterfly Colormap","title":"Change Butterfly Channel Position Color","text":"","category":"section"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"In this section we discuss how users are able change the position to colorscale of the legendtopo in the butterfly plot.","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"using UnfoldMakie\nusing CairoMakie\nusing DataFramesMeta\nusing Colors","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"By default the plot looks like this:","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"include(\"../../example_data.jl\")\nresults, positions = example_data(\"TopoPlots.jl\")\nplot_butterfly(results; positions=positions)","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"We can switch the colorscale of the position-map, by giving a function that maps from a (x,y) tuple to a color. UnfoldMakie currently provides three different ones pos2colorRGB (same as MNE-Python), pos2colorHSV (HSV colorspace), pos2colorRomaO. Whereas RGB & HSV have the benefits of being 2D colormaps, Roma0 has the benefit of being perceptualy uniform.","category":"page"},{"location":"how_to/position2color/#Similar-to-MNE","page":"Butterfly Colormap","title":"Similar to MNE","text":"","category":"section"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"plot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction = pos -> UnfoldMakie.posToColorRGB(pos)))","category":"page"},{"location":"how_to/position2color/#HSV-Space","page":"Butterfly Colormap","title":"HSV-Space","text":"","category":"section"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"plot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction=UnfoldMakie.posToColorHSV))","category":"page"},{"location":"how_to/position2color/#Uniform-Color","page":"Butterfly Colormap","title":"Uniform Color","text":"","category":"section"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"To highlight the flexibility, we can also make all lines gray, or any other arbitrary color, or function of electrode-position.","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"using Colors\nplot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction = x -> Colors.RGB(0.5)))","category":"page"},{"location":"how_to/fix_pcp/#ht_fpcp","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"","category":"section"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"Since Makie doesn't have a native function to draw PCPs, our version is somewhat experimental for general use.","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"Under certain circumstances the PCP is not visualized correctly. This leads to truncated edges of the PCP and unused space.","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"Since the plot could have more space above and below, we can change the aspect ratio of the plot with:","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"...\npc_aspect_ratio = 1,\n...","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"The cut off or overlap at each side can be fixed with:","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"...\npc_right_padding = 15,\npc_left_padding = 45,\npc_top_padding = 50,\npc_bottom_padding = 27,\n...","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"Furthermore, if the tick-number size becomes too big or small it can be changed with:","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"...\npc_tick_label_size = 25,\n...","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"By setting these manually through trial and error we can fix the visualization issues","category":"page"},{"location":"helper/","page":"Utilities","title":"Utilities","text":"UnfoldMakie.RelativeAxis\nUnfoldMakie.eeg_topoplot_series\nUnfoldMakie.eeg_topoplot_series!\nUnfoldMakie.config_kwargs!\nUnfoldMakie.eeg_matrix_to_dataframe\nUnfoldMakie.rel_to_abs_bbox\nUnfoldMakie.to_positions\nUnfoldMakie.df_timebin\nUnfoldMakie.cart3d_to_spherical\nUnfoldMakie.valType_to_symbol","category":"page"},{"location":"helper/#UnfoldMakie.RelativeAxis","page":"Utilities","title":"UnfoldMakie.RelativeAxis","text":"ax = RelativeAxis(figlike, p::NTuple{4, Float64}; kwargs...)\n\nReturns an axis which's position is relative to a GridLayout Element (via BBox) and not relative to the Scene (default Axis(..., bbox=BBox()) behavior)\n\np::NTuple{4,Float64}: Give the relative position to the GridPosition, left:right; bottom:up, typical numbers betwen 0 and 1. E.g. (0.25, 0.75, 0.25, 0.75) would center an Axis inside that GridPosition\n\nkwargs... are pasted into Axis\n\nf = Figure() ax = RelativeAxis(f[1,2], (0.25, 0.75, 0.25, 0.75))\t # returns Axis centered within f[1,2]\n\n\n\n\n\n","category":"type"},{"location":"helper/#UnfoldMakie.eeg_topoplot_series","page":"Utilities","title":"UnfoldMakie.eeg_topoplot_series","text":"function eegtopoplotseries(data::DataFrame, Δbin; y=:estimate, label=:label, col=:time, row=nothing, figure = NamedTuple(), combinefun=mean, rowlabels = false, collabels = false, topoplot_attributes... )\n\nPlot a series of topoplots. The function automatically takes the combinefun=mean over the :time column of data in Δbin steps.\n\nThe 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)).\nΔ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.\nThe 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\n\nto 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.\n\nThe 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..).\nrow_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).\n\nExamples\n\nDesc\n\njulia > df = DataFrame(:erp => repeat(1:63, 100), :time => repeat(1:20, 5 * 63), :label => repeat(1:63, 100)) # fake data\njulia > 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\njulia > pos = [Point2.(pos[k, 1], pos[k, 2]) for k in 1:size(pos, 1)]\njulia > eeg_topoplot_series(df, 5; positions=pos)\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.eeg_topoplot_series!","page":"Utilities","title":"UnfoldMakie.eeg_topoplot_series!","text":"eegtopoplotseries!(fig, data::DataFrame, Δbin; kwargs..) In place plotting of topoplot series see eegtopoplotseries(data, Δbin) for help\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.config_kwargs!","page":"Utilities","title":"UnfoldMakie.config_kwargs!","text":"Takes a kwargs named tuple of Key => NamedTuple and merges the fields with the defaults\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.eeg_matrix_to_dataframe","page":"Utilities","title":"UnfoldMakie.eeg_matrix_to_dataframe","text":"Helper function converting a matrix (channel x times) to a tidy dataframe with columns :estimate, :time and :label\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.rel_to_abs_bbox","page":"Utilities","title":"UnfoldMakie.rel_to_abs_bbox","text":"reltoabs_bbox(org,rel)\n\nTakes a rectangle org and applies the relative transformation tuple rel Returns a Makie.BBox\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.to_positions","page":"Utilities","title":"UnfoldMakie.to_positions","text":"topositions(x,y,z;sphere=[0,0,0.]) topositions(pos::AbstractMatrix;sphere=[0,0,0.]) Projects 3D electrode positions to a 2D layout.\n\nThe matrix case, assumes size(pos) = (3,nChannels) Re-implementation of the MNE algorithm.\n\nTipp: You can directly get positions from an MNE object after loading PyMNE and thus activating the UnfoldMakie PyMNE extension\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.df_timebin","page":"Utilities","title":"UnfoldMakie.df_timebin","text":"function dftimebin(df, Δbin; coly=:erp, fun=mean, grouping=[]) Split or combine dataframe according to equally spaced time bins\n\ndf AbstractTable with columns :time and col_y (default :erp), and all columns in grouping;\nΔbin bin size in :time units;\ncol_y default :erp, the column to combine over (with fun);\nfun function to combine, default is mean;\ngrouping (vector of symbols/strings) default empty vector, columns to group the data by before aggregating. Values of nothing are ignored.\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.cart3d_to_spherical","page":"Utilities","title":"UnfoldMakie.cart3d_to_spherical","text":"convert x/y/z electrode montage positions to spherical coordinate representation. output is a matrix\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.valType_to_symbol","page":"Utilities","title":"UnfoldMakie.valType_to_symbol","text":"Val{:bu}() to => :bu\n\n\n\n\n\n","category":"function"},{"location":"api/","page":"API","title":"API","text":"Modules = [UnfoldMakie]\nOrder = [:function]","category":"page"},{"location":"api/#UnfoldMakie.cart3d_to_spherical-Tuple{Any, Any, Any}","page":"API","title":"UnfoldMakie.cart3d_to_spherical","text":"convert x/y/z electrode montage positions to spherical coordinate representation. output is a matrix\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.config_kwargs!-Tuple{PlotConfig}","page":"API","title":"UnfoldMakie.config_kwargs!","text":"Takes a kwargs named tuple of Key => NamedTuple and merges the fields with the defaults\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.df_timebin-Tuple{Any, Any}","page":"API","title":"UnfoldMakie.df_timebin","text":"function dftimebin(df, Δbin; coly=:erp, fun=mean, grouping=[]) Split or combine dataframe according to equally spaced time bins\n\ndf AbstractTable with columns :time and col_y (default :erp), and all columns in grouping;\nΔbin bin size in :time units;\ncol_y default :erp, the column to combine over (with fun);\nfun function to combine, default is mean;\ngrouping (vector of symbols/strings) default empty vector, columns to group the data by before aggregating. Values of nothing are ignored.\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.eeg_matrix_to_dataframe-Tuple{Any, Any}","page":"API","title":"UnfoldMakie.eeg_matrix_to_dataframe","text":"Helper function converting a matrix (channel x times) to a tidy dataframe with columns :estimate, :time and :label\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.eeg_topoplot_series!-Tuple{Any, DataFrame, Any}","page":"API","title":"UnfoldMakie.eeg_topoplot_series!","text":"eegtopoplotseries!(fig, data::DataFrame, Δbin; kwargs..) In place plotting of topoplot series see eegtopoplotseries(data, Δbin) for help\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.eeg_topoplot_series-Tuple{DataFrame, Any}","page":"API","title":"UnfoldMakie.eeg_topoplot_series","text":"function eegtopoplotseries(data::DataFrame, Δbin; y=:estimate, label=:label, col=:time, row=nothing, figure = NamedTuple(), combinefun=mean, rowlabels = false, collabels = false, topoplot_attributes... )\n\nPlot a series of topoplots. The function automatically takes the combinefun=mean over the :time column of data in Δbin steps.\n\nThe 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)).\nΔ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.\nThe 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\n\nto 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.\n\nThe 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..).\nrow_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).\n\nExamples\n\nDesc\n\njulia > df = DataFrame(:erp => repeat(1:63, 100), :time => repeat(1:20, 5 * 63), :label => repeat(1:63, 100)) # fake data\njulia > 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\njulia > pos = [Point2.(pos[k, 1], pos[k, 2]) for k in 1:size(pos, 1)]\njulia > eeg_topoplot_series(df, 5; positions=pos)\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_butterfly-Tuple{DataFrame}","page":"API","title":"UnfoldMakie.plot_butterfly","text":"Plot Butterfly\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = NamedTuple() - use kwargs... of Makie.Axis \n\nlayout = (showLegend = false, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t)) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:channel, :channels, :trial, :trials), positions = (:pos, :positions, :position, :topoPositions, :x, nothing), labels = (:labels, :label, :topoLabels, :sensor, nothing)) \n\nvisual = (colormap = :roma,) - use kwargs... of Makielines \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of AlgebraOfGraphics.colobar! \n\nkey-word arguments\n\ntopomarkersize (Real, 10) - change the size of the markers, topoplot-inlay electrodes\ntopowidth (Real, 0.25) - change the size of the inlay topoplot width\ntopoheigth (Real, 0.25) - change the size of the inlay topoplot height\n\nsee also plot_erp\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_circulareegtopoplot-Tuple{DataFrame}","page":"API","title":"UnfoldMakie.plot_circulareegtopoplot","text":"plot_circulareegtopoplot(plotData::DataFrame;kwargs...)\nplot_circulareegtopoplot!(figlike, plotData::DataFrame;kwargs...)\n\nPlot a circular EEG topoplot.\n\nArguments:\n\nfiglike::Union{GridPosition, Figure}: Figure or GridPosition that the plot should be drawn into\nplotData::DataFrame: Dataframe with keys for data (looks for :y,:yhat, :estimate, and :position (looks for :pos, :positions, :position), \npredictor (optional; default :predictor) the circular predictor value, defines position of topoplot, is mapped around predictorBounds\npredictorBounds: Default: [0,360] - The bounds of the predictor. This is relevant for the axis labels.\ncenterlabel: default \"\", the text in the center of the cricle\npositions (nothing) - positions for the plot_topoplot\nlabels (nothing) - labels for the plot_topoplot\nkwargs...: Additional styling behavior, see below.\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = (aspect = Makie.DataAspect(), label = \"\") - use kwargs... of Makie.Axis \n\nlayout = (showLegend = false, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ()) \n\nmapping = (x = (nothing,), y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing)) \n\nvisual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), labelscatter = true, labeltext = true, boundinggeometry = GeometryBasics.Circle) - *use kwargs... of [``Topoplot.eegtopoplot``](@ref)* \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false, label = \"Voltage [µV]\", colormap = Makie.Reverse{Symbol}(:RdBu)) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nA figure containing the circular topoplot at given layout position\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_designmatrix-Tuple{Unfold.DesignMatrix}","page":"API","title":"UnfoldMakie.plot_designmatrix","text":"plot_designmatrix(plotData::Unfold.DesignMatrix;kwargs...)\n\nPlot a designmatrix. \n\nArguments:\n\nplotData::Unfold.DesignMatrix: Data for the plot visualization.\n\nkwargs\n\nstandardizeData: (bool,true) - Indicating whether the data is standardized by pointwise division of the data with its sampled standard deviation.\nsortData: (bool, true) - Indicating whether the data is sorted; using sortslices() of Base Julia. \nxTicks: (nothing) \n\nIndicating the number of labels on the x-axis. Behavior if specified in configuration:\n\nxTicks = 0: no labels are placed.\nxTicks = 1: first possible label is placed.\nxTicks = 2: first and last possible labels are placed.\n2 < xTicks < number of labels: Equally distribute the labels.\nxTicks ≥ number of labels: all labels are placed.\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = (xticklabelrotation = 0.39269908169872414,) - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y)) \n\nvisual = (colormap = :roma,) - use kwargs... of Makieheatmap \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nA figure displaying the designmatrix. \n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_erp-Tuple{DataFrame}","page":"API","title":"UnfoldMakie.plot_erp","text":"plot_erp!(f::Union{GridPosition, Figure}, plotData::DataFrame; kwargs...)\nplot_erp(plotData::DataFrame; kwargs...)\n\nPlot an ERP plot.\n\nArguments:\n\nf::Union{GridPosition, Figure}: Figure or GridPosition that the plot should be drawn into\nplotData::DataFrame: Data for the line plot visualization.\nkwargs...: Additional styling behavior. Often used: plot_erp(df; mapping=(; color=:coefname, col=:conditionA))\n\nkwargs (...; ...):\n\ncategoricalColor (bool, true) - Indicates whether the column referenced in mapping.color should be used nonnumerically.\ncategoricalGroup (bool, true) - Indicates whether the column referenced in mapping.group should be used nonnumerically.\ntopoLegend (bool, false) - Indicating whether a topo plot is used as a legend.\nstderror (bool, false) - Indicating whether the plot should show a colored band showing lower and higher estimates based on the stderror. \npvalue (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\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = NamedTuple() - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t)) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:color, :coefname, nothing)) \n\nvisual = (colormap = :roma,) - use kwargs... of Makielines \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of AlgebraOfGraphics.colobar! \n\nReturn Value:\n\nf - Figure() or the inputed f\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_new-Tuple{}","page":"API","title":"UnfoldMakie.plot_new","text":"plot_new() -> String\n\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = NamedTuple() - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t)) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:color, :coefname, nothing)) \n\nvisual = (colormap = :roma,) - use kwargs... of Makielines \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of AlgebraOfGraphics.colobar! \n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_parallelcoordinates-Tuple{DataFrame, Vector{Int64}}","page":"API","title":"UnfoldMakie.plot_parallelcoordinates","text":"plot_parallelcoordinates!(f::Union{GridPosition, Figure}, plotData::DataFrame, config::PlotConfig; channels::Vector{Int64})\n\nPlot a PCP (parallel coordinates plot).\n\nArguments:\n\nf::Union{GridPosition, Figure}: Figure or GridPosition that the plot should be drawn into\nplotData::DataFrame: Data for the plot visualization.\nconfig::PlotConfig: Instance of PlotConfig being applied to the visualization.\nchannels::Vector{Int64}: vector with all the channels representing an axis used in the PCP in given order.\n\nPCP 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\n\npc_aspect_ratio Default : 0.55\n\npc_right_padding Default : 15\n\npc_left_padding Default : 25\n\npc_top_padding Default : 26\n\npc_bottom_padding Default : 16\n\npc_tick_label_size Default : 14\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = NamedTuple() - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :channel, ylabelFromMapping = :y, useColorbar = false, hidespines = (), hidedecorations = (label = false,)) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y), channel = :channel, category = :category, time = :time) \n\nvisual = (colormap = :roma,) - use kwargs... of Makielines \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nThe input f\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_topoplot-Tuple{Union{DataFrame, Vector{Float32}}}","page":"API","title":"UnfoldMakie.plot_topoplot","text":"plot_topoplot!(f::Union{GridPosition, Figure}, plotData, ; positions=nothing, labels=nothing,kwargs...)\nplot_topoplot(plotData,; positions=nothing, labels=nothing,kwargs...)\n\nPlot a topo plot.\n\nArguments:\n\nf::Union{GridPosition, Figure}: Figure or GridPosition (e.g. f[2, 3]) that the plot should be drawn into. New axis is created.\nplotData::Union{DataFrame, Vector{Float32}}: Data for the plot visualization.\npositions::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.\nlabels::Vector{String}=nothing: labels used if plotData is no DataFrame.\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = (aspect = Makie.DataAspect(),) - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ()) \n\nmapping = (x = (nothing,), y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing)) \n\nvisual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), labelscatter = true, labeltext = true, boundinggeometry = GeometryBasics.Circle) - *use kwargs... of [``Topoplot.eegtopoplot``](@ref)* \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nA figure displaying the topo plot.\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_topoplotseries-Tuple{DataFrame, Real}","page":"API","title":"UnfoldMakie.plot_topoplotseries","text":"plot_topoplotseries!(f::Union{GridPosition, Figure}, plotData::DataFrame,Δbin::Real;kwargs...)\nplot_topoplotseries!(plotData::DataFrame, Δbin::Real;kwargs...)\n\nPlot a Topoplot Series.\n\nArguments:\n\nf::Union{GridPosition, Figure}: Figure or GridPosition that the plot should be drawn into\nplotData::DataFrame: DataFrame with data, needs a time column\nΔbin::Real: A number for how large one bin should be. Δbin is in units of the plotData.time column\ncombinefun (default mean) can be used to specify how the samples within Δbin are combined.\nrasterize_heatmaps (deault true) - enforce rasterization of the plot heatmap when saving in svg format.\n\nThis 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.\n\ncol_labels, row_labels - shows column and row labels. \n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = (aspect = Makie.DataAspect(),) - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ()) \n\nmapping = (x = (nothing,), y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing), col = (:time,), row = (nothing,)) \n\nvisual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), labelscatter = true, labeltext = false, boundinggeometry = GeometryBasics.Circle) - *use kwargs... of [``Topoplot.eegtopoplot``](@ref)* \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nThe input f\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.rel_to_abs_bbox-Tuple{Any, Any}","page":"API","title":"UnfoldMakie.rel_to_abs_bbox","text":"reltoabs_bbox(org,rel)\n\nTakes a rectangle org and applies the relative transformation tuple rel Returns a Makie.BBox\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.to_positions-Tuple{AbstractMatrix}","page":"API","title":"UnfoldMakie.to_positions","text":"topositions(x,y,z;sphere=[0,0,0.]) topositions(pos::AbstractMatrix;sphere=[0,0,0.]) Projects 3D electrode positions to a 2D layout.\n\nThe matrix case, assumes size(pos) = (3,nChannels) Re-implementation of the MNE algorithm.\n\nTipp: You can directly get positions from an MNE object after loading PyMNE and thus activating the UnfoldMakie PyMNE extension\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.valType_to_symbol-Tuple{Any}","page":"API","title":"UnfoldMakie.valType_to_symbol","text":"Val{:bu}() to => :bu\n\n\n\n\n\n","category":"method"},{"location":"api/","page":"API","title":"API","text":"Internally, we use a PlotConfig struct to keep track of common plot options, in order to have a similar API to all functions","category":"page"},{"location":"api/","page":"API","title":"API","text":"PlotConfig","category":"page"},{"location":"api/#UnfoldMakie.PlotConfig","page":"API","title":"UnfoldMakie.PlotConfig","text":"PlotConfig()\nholds various different fields, that can modify various different plotting aspects.\n\n\n\n\n\n","category":"type"},{"location":"how_to/mult_vis_in_fig/#ht_mvf","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"","category":"section"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"using UnfoldMakie\nusing CairoMakie\nusing DataFramesMeta\nusing UnfoldSim\nusing Unfold\nusing MakieThemes\nset_theme!(theme_ggthemr(:fresh)) # nicer defaults - should maybe be default?\n","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"include(\"../../example_data.jl\")\nd_topo, positions = example_data(\"TopoPlots.jl\")\nuf_deconv = example_data(\"UnfoldLinearModelContinuousTime\")\nuf = example_data(\"UnfoldLinearModel\")\nresults = coeftable(uf)\nuf_5chan = example_data(\"UnfoldLinearModelMultiChannel\")\nd_singletrial, _ = UnfoldSim.predef_eeg(; return_epoched=true)\ntimes = -0.099609375:0.001953125:1.0\nnothing #hide","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"This section discusses how users can incorporate multiple plots into a single figure.","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"By using the !-version of the plotting function and inserting a grid position instead of an entire figure, we can create multiple coordinated views.","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"We start by creating a figure with Makie.Figure. ","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"f = Figure()","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"Now any plot can be added to f by placing a grid position, such as f[1,1].","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"\nf = Figure()\nplot_erp!(f[1, 1], coeftable(uf_deconv))\nplot_erp!(f[1, 2], effects(Dict(:condition => [\"car\", \"face\"]), uf_deconv), mapping=(; color=:condition))\nplot_butterfly!(f[2, 1:2], d_topo; positions=positions)\n\nf","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"Using the data from the tutorials, we can create a large image with any type of plot.","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"With so many plots at once, it's tempting to set a fixed resolution in your image to order the plots evenly (code below).","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"\nf = Figure(resolution=(2000, 2000))\n\nplot_butterfly!(f[1, 1:3], d_topo; positions=positions)\n\npvals = DataFrame(\n from=[0.1, 0.15],\n to=[0.2, 0.5],\n # if coefname not specified, line should be black\n coefname=[\"(Intercept)\", \"category: face\"]\n)\nplot_erp!(f[2, 1:2], results, \n categoricalColor=false,\n categoricalGroup=false,\n pvalue=pvals,\n stderror=true)\n\n\nplot_designmatrix!(f[2, 3], designmatrix(uf))\n\nplot_topoplot!(f[3, 1], collect(1:64); positions=positions, visual=(; colormap=:viridis))\nplot_topoplotseries!(f[4, 1:3], d_topo, 0.1; positions=positions, mapping=(; label=:channel))\n\nres_effects = effects(Dict(:continuous => -5:0.5:5), uf_deconv)\n\nplot_erp!(f[2, 4:5], res_effects;\n mapping=(; y=:yhat, color=:continuous, group=:continuous),\n showLegend=true,\n categoricalColor=false,\n categoricalGroup=true,\n legend=(; nbanks=2),\n layout=(; legendPosition=:right))\n\nplot_parallelcoordinates!(f[3, 2:3], uf_5chan, [1, 2, 3, 4, 5]; mapping=(; color=:coefname), layout=(; legendPosition=:bottom))\n\nplot_erpimage!(f[1, 4:5], times, d_singletrial)\nplot_circulareegtopoplot!(f[3:4, 4:5], d_topo[in.(d_topo.time, Ref(-0.3:0.1:0.5)), :];\n positions=positions, predictor=:time,predictorBounds=[-0.3, 0.5])\n\nf","category":"page"},{"location":"tutorials/topoplotseries/#tpseries_vis","page":"Topo Plot Series","title":"Topo Plot SeriesVisualization","text":"","category":"section"},{"location":"tutorials/topoplotseries/#Include-used-Modules","page":"Topo Plot Series","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie\nusing TopoPlots","category":"page"},{"location":"tutorials/topoplotseries/#Plot-Topo-Plots-Series","page":"Topo Plot Series","title":"Plot Topo Plots Series","text":"","category":"section"},{"location":"tutorials/topoplotseries/#Giving-the-Data","page":"Topo Plot Series","title":"Giving the Data","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"In case you do not already have data, you can get example data from the TopoPlots module. You can do it like this:","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"data, positions = TopoPlots.example_data()\ndf = UnfoldMakie.eeg_matrix_to_dataframe(data[:,:,1], string.(1:length(positions)));\nnothing #hide","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"Δbin = 80\nplot_topoplotseries(df, Δbin; positions = positions)","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"With colorbar:","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"plot_topoplotseries(df, Δbin; positions=positions, layout = (; useColorbar=true))","category":"page"},{"location":"tutorials/topoplotseries/#Positions","page":"Topo Plot Series","title":"Positions","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"You can give either positions, or labels. If both are provided, positions have priority","category":"page"},{"location":"tutorials/topoplotseries/#plot_toposeries(...;-mapping(;-keyvalue))","page":"Topo Plot Series","title":"plot_toposeries(...; mapping=(; key=value))","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"mapping=(: y=(:estimate, :yhat, :y))","category":"page"},{"location":"tutorials/topoplotseries/#visual(;)","page":"Topo Plot Series","title":"visual=(;)","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"label_text (boolean, false) Indicates whether label should drawn next to their position. The labels have to be given into the function seperately:","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"important: Important\ncurrently bugged","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"label_scatter (boolean, true) - Indicates whether the dots should be drawn at the given positions.","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"EditURL = \"../../../literate/reference/positions.jl\"","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"using UnfoldMakie\nusing CairoMakie\nusing TopoPlots\nusing PyMNE","category":"page"},{"location":"generated/reference/positions/#get-MNE-positions","page":"Convert 3D positions / montages to 2D layouts","title":"get MNE-positions","text":"","category":"section"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"Generate a fake MNE structure taken from mne documentation","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"biosemi_montage = PyMNE.channels.make_standard_montage(\"biosemi64\")\nn_channels = length(biosemi_montage.ch_names)\nfake_info = PyMNE.create_info(ch_names=biosemi_montage.ch_names, sfreq=250.,\n ch_types=\"eeg\")\ndata = rand(n_channels,1) * 1e-6\nfake_evoked = PyMNE.EvokedArray(data, fake_info)\nfake_evoked.set_montage(biosemi_montage)\n\npos = to_positions(fake_evoked)","category":"page"},{"location":"generated/reference/positions/#project-from-3D-electrode-locations-to-2D","page":"Convert 3D positions / montages to 2D layouts","title":"project from 3D electrode locations to 2D","text":"","category":"section"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"pos3d = hcat(values(pyconvert(Dict,biosemi_montage.get_positions()[\"ch_pos\"]))...)\n\npos2 = to_positions(pos3d)\n\nf = Figure(resolution=(600,300))\nscatter(f[1,1],pos3d[1:2,:])\nscatter(f[1,2],pos2)\nf","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"as one can see, the \"naive\" transform of just dropping the third dimension doesnt really work (left). We rather have to project the chanels to a sphere and unfold it (right)","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/parallelcoordinates/#pcp_vis","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Here we discuss parallel coordinates plot (PCP) visualization. ","category":"page"},{"location":"tutorials/parallelcoordinates/#Include-used-Modules","page":"Parallel Coordinates Plot","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie","category":"page"},{"location":"tutorials/parallelcoordinates/#Data","page":"Parallel Coordinates Plot","title":"Data","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"We use the test data of erpcore-N170.jld2.","category":"page"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"include(\"../../example_data.jl\")\nresults_plot, positions = example_data();","category":"page"},{"location":"tutorials/parallelcoordinates/#Plot-PCPs","page":"Parallel Coordinates Plot","title":"Plot PCPs","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"plot_parallelcoordinates(results_plot, [5,3,2]; # this selects channel 5,3 & 2 \n mapping = (color = :coefname, y = :estimate))","category":"page"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"important: Important\nthe following is still outdated...","category":"page"},{"location":"tutorials/parallelcoordinates/#Column-Mappings-for-PCPs","page":"Parallel Coordinates Plot","title":"Column Mappings for PCPs","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Since PCPs use a DataFrame as an input, the library needs to know the names of the columns used for plotting.","category":"page"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"While there are multiple default values that are checked in that order if they exist in the DataFrame, a custom name might need to be choosen for:","category":"page"},{"location":"tutorials/parallelcoordinates/#y","page":"Parallel Coordinates Plot","title":"y","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Default is (:y, :estimate, :yhat).","category":"page"},{"location":"tutorials/parallelcoordinates/#channel","page":"Parallel Coordinates Plot","title":"channel","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Default is :channel.","category":"page"},{"location":"tutorials/parallelcoordinates/#color","page":"Parallel Coordinates Plot","title":"color","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"XXX Default is :coef.","category":"page"},{"location":"tutorials/parallelcoordinates/#time","page":"Parallel Coordinates Plot","title":"time","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Default is :time.","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"EditURL = \"../../../literate/tutorials/erp.jl\"","category":"page"},{"location":"generated/tutorials/erp/#lp_vis","page":"ERP plot","title":"Line Plot Visualization","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Here we discuss line plot visualization. Make sure you have looked into the installation instructions.","category":"page"},{"location":"generated/tutorials/erp/#Include-used-Modules","page":"ERP plot","title":"Include used Modules","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie\nusing DataFramesMeta\nusing UnfoldSim\nusing UnfoldMakie","category":"page"},{"location":"generated/tutorials/erp/#Setup","page":"ERP plot","title":"Setup","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Let's generate some data and fit a model of a 2-level categorical and a continuous predictor with interaction.","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"data, evts = UnfoldSim.predef_eeg(; noiselevel = 12, return_epoched = true)\ndata = reshape(data, (1, size(data)...))\nf = @formula 0 ~ 1 + condition + continuous\nse_solver = (x, y) -> Unfold.solver_default(x, y, stderror = true);\n\nm = fit(\n UnfoldModel,\n Dict(Any => (f, range(0, step = 1 / 100, length = size(data, 2)))),\n evts,\n data,\n solver = se_solver,\n)\nresults = coeftable(m)\nres_effects = effects(Dict(:continuous => -5:0.5:5), m);\nnothing #hide","category":"page"},{"location":"generated/tutorials/erp/#Plot-the-results","page":"ERP plot","title":"Plot the results","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp(results; :stderror => true,)","category":"page"},{"location":"generated/tutorials/erp/#Column-Mappings-for-Line-Plots","page":"ERP plot","title":"Column Mappings for Line Plots","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp use a DataFrame as an input, the library needs to know the names of the columns used for plotting.","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"There are multiple default values, that are checked in that order if they exist in the DataFrame, a custom name can be chosen using plot_erp(...;mapping=(; :y=:myEstimate)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":":x Default is (:x, :time). :y Default is (:y, :estimate, :yhat). :color Default is (:color, :coefname).","category":"page"},{"location":"generated/tutorials/erp/#Configuration-for-Line-Plots","page":"ERP plot","title":"Configuration for Line Plots","text":"","category":"section"},{"location":"generated/tutorials/erp/#key-values","page":"ERP plot","title":"key values","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp(...; =,...).","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"categoricalColor (boolean, true) - in case of numeric :color column, is color a continuous or categorical variable?\ncategoricalGroup (boolean, true) - in case of numeric :group column, treat :group as categorical variable by default\nstderror (boolean, false) - add an error-ribbon based on the :stderror column\npvalue (see below)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Using some general configurations we can pretty up the default visualization. Here we use the following configuration:","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp(\n res_effects;\n mapping = (; y = :yhat, color = :continuous, group = :continuous),\n legend = (; nbanks = 2),\n layout = (; legendPosition = :right),\n showLegend = true, categoricalColor = false, categoricalGroup = true,\n)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"In the following we will use this \"pretty\" line plot as a basis for looking into configuration options.","category":"page"},{"location":"generated/tutorials/erp/#pvalue-(array)","page":"ERP plot","title":"pvalue (array)","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"important: Important\nthis is currently broken!","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Is an array of p-values. If array not empty, plot shows colored lines under the plot representing the p-values. Default is [] (an empty array). Shown below is an example in which pvalue are given: pvals = DataFrame(","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"#\t\tfrom=[0.1,0.3],\n#\t\tto=[0.5,0.7],\n#\t\tcoefname=[\"(Intercept)\",\"condition: face\"] # if coefname not specified, line should be black\n#\t)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp(results; :pvalue=>pvals)","category":"page"},{"location":"generated/tutorials/erp/#stderror-(boolean)","page":"ERP plot","title":"stderror (boolean)","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Indicating whether the plot should show a colored band showing lower and higher estimates based on the stderror. Default is false.","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"previously we showed :stderror- but low/high is possible as well`","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"results.se_low = results.estimate .- 0.5\nresults.se_high = results.estimate .+ 0.15\nplot_erp(select(results, Not(:stderror)); stderror = true)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"note: Note\nas in the above code,:stderror has precedence over :se_low/:se_high","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/erpimage/#erpi_vis","page":"ERP Image","title":"ERP Image Visualization","text":"","category":"section"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"Here we discuss ERP image visualization. Make sure you have looked into the installation instructions.","category":"page"},{"location":"tutorials/erpimage/#Include-used-Modules","page":"ERP Image","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"using Unfold\nusing UnfoldMakie\nusing CairoMakie\nusing UnfoldSim\ninclude(\"../../example_data.jl\")","category":"page"},{"location":"tutorials/erpimage/#Plot-ERP-Images","page":"ERP Image","title":"Plot ERP Images","text":"","category":"section"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"The following code will result in the default configuration. ","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"data, evts = UnfoldSim.predef_eeg(; noiselevel=10, return_epoched=true)\nplot_erpimage(data)","category":"page"},{"location":"tutorials/erpimage/#Column-Mappings-for-ERP-Images","page":"ERP Image","title":"Column Mappings for ERP Images","text":"","category":"section"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"Since ERP images use a Matrix as an input, the library does not need any informations about the mapping.","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"erpBlur (number, 10) - Is a number indicating how much blur is applied to the image; using Gaussian blur of the ImageFiltering module. Negative values deactivate the blur.\nsortvalues - Indicating whether the data is sorted; using sortperm() of Base Julia ","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"(sortperm() computes a permutation of the array's indices that puts the array into sorted order). ","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"meanPlot (bool, false) - Indicating whether the plot should add a line plot below the ERP image, showing the mean of the data. If limits are set in the axis values both plots will be aligned.","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"plot_erpimage(data;\n meanPlot = true,\n colorbar = (label = \"Voltage [µV]\",),\n visual = (colormap = :viridis, colorrange = (-40, 40)))\n","category":"page"},{"location":"tutorials/butterfly/#bfp_vis","page":"Butterfly Plot","title":"Butterfly Plot Visualization","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Here we discuss butterfly plot visualization. Make sure you have looked into the installation instructions.","category":"page"},{"location":"tutorials/butterfly/#Include-used-Modules","page":"Butterfly Plot","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"using UnfoldMakie\nusing Unfold\nusing CairoMakie\nusing DataFrames","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Note that DataFramesMeta is also used here in order to be able to use @subset for testing (filtering).","category":"page"},{"location":"tutorials/butterfly/#Data","page":"Butterfly Plot","title":"Data","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"We filter the data to make it more clearly represented:","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"include(\"../../example_data.jl\")\ndf, pos = example_data(\"TopoPlots.jl\")\nfirst(df, 3)","category":"page"},{"location":"tutorials/butterfly/#Plot-Butterfly-Plots","page":"Butterfly Plot","title":"Plot Butterfly Plots","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"The following code will plot the default butterfly plot","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"plot_butterfly(df)","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"or if you provide the channel positions:","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"plot_butterfly(df; positions=pos)","category":"page"},{"location":"tutorials/butterfly/#Column-Mappings-for-Butterfly-Plots","page":"Butterfly Plot","title":"Column Mappings for Butterfly Plots","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Since butterfly plots use a DataFrame as input, the library needs to know the names of the columns used for plotting. You can set these mapping values by calling plot_butterfly(...; mapping=(; :x=:time,)), that is, by specifying a NamedTuple (note the ; right after the opening parentheses).","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"While there are several default values that will be checked in that order if they exist in the DataFrame, a custom name may need to be chosen:","category":"page"},{"location":"tutorials/butterfly/#x","page":"Butterfly Plot","title":"x","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Default is (:x, :time).","category":"page"},{"location":"tutorials/butterfly/#y","page":"Butterfly Plot","title":"y","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Default is (:y, :estimate, :yhat).","category":"page"},{"location":"tutorials/butterfly/#labels","page":"Butterfly Plot","title":"labels","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Default is (:labels, :label, :topoLabels, :sensor, :nothing)","category":"page"},{"location":"tutorials/butterfly/#Configurations-for-Butterfly-Plots","page":"Butterfly Plot","title":"Configurations for Butterfly Plots","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Here we look into possible options for configuring the butterfly plot visualization using (...; =, ...). This is the list of unique configuration (key values):","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"topoLegend (boolean)","category":"page"},{"location":"tutorials/butterfly/#topoLegend-(boolean)","page":"Butterfly Plot","title":"topoLegend (boolean)","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Indicating whether the topo legend is displayed. Default is true.","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"For more general options look into the Plot Configuration section of the documentation.","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Since the configurations for line plots can be applied to butterfly plots as well. Here you can find the configurations for line plots, ","category":"page"},{"location":"tutorials/topoplot/#tp_vis","page":"Topo Plot","title":"Topo Plot Visualization","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Here we discuss topo plot visualization. Make sure you have looked into the installation instructions.","category":"page"},{"location":"tutorials/topoplot/#Include-used-Modules","page":"Topo Plot","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie\nusing TopoPlots","category":"page"},{"location":"tutorials/topoplot/#Plot-Topo-Plots","page":"Topo Plot","title":"Plot Topo Plots","text":"","category":"section"},{"location":"tutorials/topoplot/#Providing-the-Data","page":"Topo Plot","title":"Providing the Data","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"data, positions = TopoPlots.example_data()","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"We select one datapoint, and the first enry of dimension 3 (the mean estimate, the others are p-value and std)","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"plot_topoplot(data[:,340,1]; positions = positions)","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"using DataFrames\ndf = DataFrame(:estimate => data[:,340,1])\nplot_topoplot(df; positions = positions)","category":"page"},{"location":"tutorials/topoplot/#Giving-the-Positions","page":"Topo Plot","title":"Giving the Positions","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Since the topo plot needs the positions of the sensors they have to be put into the drawing function. But there are multiple options (In order of prioritization):","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Giving the positions directly: plot_topoplot(...; positions=[...])\nGiving the labels of the sensors: plot_topoplot(...; labels=[...])","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"To get the positions from the labels we use a database.","category":"page"},{"location":"tutorials/topoplot/#Column-Mappings-for-Topo-Plots","page":"Topo Plot","title":"Column Mappings for Topo Plots","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"When using topo plots with a DataFrame as an input, the library needs to know the names of the columns used for plotting. This is specified using the mapping=(;) kwargs.","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"While there are multiple default values, that are checked in that order if they exist in the DataFrame, a custom name might need to be choosen for:","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Note that only one of positions or labels have to be set to draw a topo plot. If both are set, positions takes precedence, labels might be used for labelling electrodes in TopoPlots.jl","category":"page"},{"location":"tutorials/topoplot/#(...,mapping(;))","page":"Topo Plot","title":"(...,mapping=(;))","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":":y plotting function looks in the default columns of mapping","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"cfgDefault = UnfoldMakie.PlotConfig()\ncfgDefault.mapping.y","category":"page"},{"location":"tutorials/topoplot/#label_text-(boolean)","page":"Topo Plot","title":"label_text (boolean)","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Indicates whether label should drawn next to their position. Obviously the labels have to be provided: plot_topoplot(...; labels=[...])","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"plot_topoplot(...; visual=(; label_text=true))","category":"page"},{"location":"tutorials/topoplot/#label_scatter-(boolean)","page":"Topo Plot","title":"label_scatter (boolean)","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Indicates whether the dots should be drawn at the given positions.","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"plot_topoplot(...; visual=(; label_scatter=true))","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"data, positions = TopoPlots.example_data()\nplot_topoplot(data[1:4,340,1]; visual = (; label_scatter = false), labels=[\"O1\", \"F2\", \"F3\", \"P4\"])","category":"page"},{"location":"tutorials/designmatrix/#dm_vis","page":"Designmatrix","title":"Designmatrix Visualization","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"Here we discuss designmatrix visualization. Make sure you have looked into the installation instructions section. ","category":"page"},{"location":"tutorials/designmatrix/#Include-used-Modules","page":"Designmatrix","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie","category":"page"},{"location":"tutorials/designmatrix/#Data","page":"Designmatrix","title":"Data","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"include(\"../../example_data.jl\")\nuf = example_data(\"UnfoldLinearModel\")\n","category":"page"},{"location":"tutorials/designmatrix/#Plot-Designmatrices","page":"Designmatrix","title":"Plot Designmatrices","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"The following code will result in the default configuration. ","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"plot_designmatrix(designmatrix(uf))","category":"page"},{"location":"tutorials/designmatrix/#kwargs-plot_designmatrix(...;-...).","page":"Designmatrix","title":"kwargs plot_designmatrix(...; ...).","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"sortData (boolean,false) - Indicating whether the data is sorted; using sortslices() of Base Julia. ","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"In order to make the designmatrix easier to read, you may want to sort it.","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"plot_designmatrix(designmatrix(uf); sortData=true)","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"standardizeData (boolean, false) - Indicating whether the data is standardized, mapping the values between 0 and 1. \nxTicks (number, nothing)","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"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: xTicks-2 labels are placed between the first and last. - xTicks ≥ number of labels: all labels are placed.","category":"page"},{"location":"how_to/hide_deco/#ht_hide_deco","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"","category":"section"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"This section discusses how users can efficiently hide axis spines and decorations in their plots.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"While it's possible to hide these axis decorations by setting the axis settings with axis=(;...), Makie.Axis provides multiple variables for different aspects of the plot. This means that removing all decorations is only possible by setting many variables each time.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"Makie does provide methods like hidespines! and hidedecorations!, but the user may not have easy access to the axis their plot is drawn in.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"Instead, these functions can be called by setting variables with layout = (;):","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"... layout = (\n ...\n hidespines = (),\n hidedecorations = ()\n)","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"Since these values reflect the input to the function, we can use an empty tuple to remove all decorations and spines, respectively","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"And using hidespines = (:r, :t) will remove the top and right borders.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"For more information on the input of these functions refer to the Makie dokumentation on Axis.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"Since some plots hide features by default, the hiding can be reverted by setting the variables to nothing","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"using TopoPlots\nusing UnfoldMakie\nusing CairoMakie\n\ndata, positions = TopoPlots.example_data()\nplot_topoplot(data[:,340,1]; \n positions = positions, \n layout=(;\n hidespines = nothing,\n hidedecorations = nothing\n ),)","category":"page"},{"location":"#UnfoldMakie-Documentation","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"","category":"section"},{"location":"","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"This is the documentation of the UnfoldMakie module for the Julia programming language. ","category":"page"},{"location":"#About","page":"UnfoldMakie Documentation","title":"About","text":"","category":"section"},{"location":"","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"UnfoldMakie aims to allow users to create different types of visualizations. These include line plots, butterfly plots, design matrices, parallel coordinate plots, ERP images, and topo plots. Building on the Unfold and Makie Modules, it also allows users to customize the plots through an input configuration.","category":"page"},{"location":"","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"As can be seen from the types of visualizations possible, these configuration options try to enable the user to create plots that are helpful in the field of computational EEG. One such example is the ability to use a topo plot as a legend for a line plot by allowing multiple visualizations within a figure.","category":"page"},{"location":"","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"(Image: Coordinated Multiple Views)","category":"page"},{"location":"tutorials/installation/#install_instruct","page":"Installation","title":"Installation","text":"","category":"section"},{"location":"tutorials/installation/#Getting-Julia","page":"Installation","title":"Getting Julia","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"You can install Julia by following the instructions from the official website. ","category":"page"},{"location":"tutorials/installation/#Setup-UnfoldMakie.jl","page":"Installation","title":"Setup UnfoldMakie.jl","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"After installing Julia, you can execute the julia.exe. ","category":"page"},{"location":"tutorials/installation/#Generate-a-Project","page":"Installation","title":"Generate a Project","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"If you do not yet have a project you can generate one. First you type ] into the Julia console to switch from julia to (@VERSION) pkg. Here you can generate a project by using the command: ","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"generate \"FOLDER_PATH\"","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"Note that the specific folder in which you want to generate the project does not already exist.","category":"page"},{"location":"tutorials/installation/#Activate-your-Project","page":"Installation","title":"Activate your Project","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"Before you can add the necessary modules to use UnfoldMakie you have to activate your project in the (@VERSION) pkg environment. The command is: ","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"activate \"FOLDER_PATH\"","category":"page"},{"location":"tutorials/installation/#Install-the-UnfoldMakie-Module","page":"Installation","title":"Install the UnfoldMakie Module","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"When your project is activated you can add the module. The command is: ","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"add UnfoldMakie","category":"page"},{"location":"tutorials/installation/#Using-the-Project-in-a-Notebook","page":"Installation","title":"Using the Project in a Notebook","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"In case you want to use this generated project in a notebook (e.g. Pluto or Jupyter), you can activate this in the notebook in the following manner:","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"begin\n using Pkg\n Pkg.activate(\"FOLDER_PATH\")\n Pkg.resolve()\nend","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"Use slash / for the folder path. ","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"EditURL = \"../../../literate/tutorials/circTopo.jl\"","category":"page"},{"location":"generated/tutorials/circTopo/#Circular-Topoplot-Arrangement","page":"Circular TopoPlot","title":"Circular Topoplot Arrangement","text":"","category":"section"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"using UnfoldMakie\nusing CairoMakie\nusing TopoPlots # for example data\nusing Random\nusing DataFrames","category":"page"},{"location":"generated/tutorials/circTopo/#Generate-data","page":"Circular TopoPlot","title":"Generate data","text":"","category":"section"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"Generate a Dataframe. We need to specify the TopoPlot Positions either via position, or via labels (according to TopoPlots.jl)","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"data, pos = TopoPlots.example_data();\ndat = data[:, 240, 1]\ndf = DataFrame(\n :estimate => eachcol(Float64.(data[:, 100:40:300, 1])),\n :circularVariable => [0, 50, 80, 120, 180, 210],\n :time => 100:40:300,\n)\ndf = flatten(df, :estimate);\nnothing #hide","category":"page"},{"location":"generated/tutorials/circTopo/#Our-first-plot!","page":"Circular TopoPlot","title":"Our first plot!","text":"","category":"section"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"note how the plots are at the angles of circularVariable`","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"plot_circulareegtopoplot(\n df;\n positions = pos,\n axis = (; label = \"Sac Incoming\"),\n predictor = :circularVariable,\n)","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"In case the bounding variable is not between 0 and 360, as here we use actually time, we have to specify it. e.g.","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"plot_circulareegtopoplot(\n df;\n positions = pos,\n axis = (; label = \"Time?!\"),\n predictor = :time,\n predictorBounds = [80, 320],\n)","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"This page was generated using Literate.jl.","category":"page"}] +[{"location":"how_to/show_oob_labels/#ht_soobl","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"","category":"section"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"When visualizing a design matrix, it can happen that the labels on the y-axis get cut off to the left (especially if they are quite long). In the following, we will discuss a possible quick solution to this problem.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"We start with the \"label-limited\" time-expanded designmatrix from the corresponding Tutorial section, which describes in detail how to generate it.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"plot_designmatrix(designmatrix!(ufCont,evts), cDesign; xTicks=10, sortData=false)","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"While the plot automatically sets its height according to the labels, the labels are cut off on the left side.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"A quick fix would be to place an empty plot to the left of the designmatrix.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"By creating your own figure with Makie.Figure and then giving the designmatrix only a certain grid position, we get white space next to the plot.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"The plot! function inside the plot config instance can take any grid position, and the figure f will contain the plot and enough white space next to it.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"The exact numbers in the grid position can be guessed from the overlap ratio, or just tried.","category":"page"},{"location":"how_to/show_oob_labels/","page":"Show out of Bounds Label","title":"Show out of Bounds Label","text":"f = Figure()\nplot_design(f[1,2:6], designmatrix!(ufCont, evts), cDesign; setExtraValues=(xTicks=10, sortData=false))\n\nf","category":"page"},{"location":"how_to/position2color/#ht_p2c","page":"Butterfly Colormap","title":"Change Butterfly Channel Position Color","text":"","category":"section"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"In this section we discuss how users are able change the position to colorscale of the legendtopo in the butterfly plot.","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"using UnfoldMakie\nusing CairoMakie\nusing DataFramesMeta\nusing Colors","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"By default the plot looks like this:","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"include(\"../../example_data.jl\")\nresults, positions = example_data(\"TopoPlots.jl\")\nplot_butterfly(results; positions=positions)","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"We can switch the colorscale of the position-map, by giving a function that maps from a (x,y) tuple to a color. UnfoldMakie currently provides three different ones pos2colorRGB (same as MNE-Python), pos2colorHSV (HSV colorspace), pos2colorRomaO. Whereas RGB & HSV have the benefits of being 2D colormaps, Roma0 has the benefit of being perceptualy uniform.","category":"page"},{"location":"how_to/position2color/#Similar-to-MNE","page":"Butterfly Colormap","title":"Similar to MNE","text":"","category":"section"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"plot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction = pos -> UnfoldMakie.posToColorRGB(pos)))","category":"page"},{"location":"how_to/position2color/#HSV-Space","page":"Butterfly Colormap","title":"HSV-Space","text":"","category":"section"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"plot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction=UnfoldMakie.posToColorHSV))","category":"page"},{"location":"how_to/position2color/#Uniform-Color","page":"Butterfly Colormap","title":"Uniform Color","text":"","category":"section"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"To highlight the flexibility, we can also make all lines gray, or any other arbitrary color, or function of electrode-position.","category":"page"},{"location":"how_to/position2color/","page":"Butterfly Colormap","title":"Butterfly Colormap","text":"using Colors\nplot_butterfly(results; positions=positions, extra=(; topoPositionToColorFunction = x -> Colors.RGB(0.5)))","category":"page"},{"location":"how_to/fix_pcp/#ht_fpcp","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"","category":"section"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"Since Makie doesn't have a native function to draw PCPs, our version is somewhat experimental for general use.","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"Under certain circumstances the PCP is not visualized correctly. This leads to truncated edges of the PCP and unused space.","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"Since the plot could have more space above and below, we can change the aspect ratio of the plot with:","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"...\npc_aspect_ratio = 1,\n...","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"The cut off or overlap at each side can be fixed with:","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"...\npc_right_padding = 15,\npc_left_padding = 45,\npc_top_padding = 50,\npc_bottom_padding = 27,\n...","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"Furthermore, if the tick-number size becomes too big or small it can be changed with:","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"...\npc_tick_label_size = 25,\n...","category":"page"},{"location":"how_to/fix_pcp/","page":"Fix Parallel Coordinates Plot","title":"Fix Parallel Coordinates Plot","text":"By setting these manually through trial and error we can fix the visualization issues","category":"page"},{"location":"helper/","page":"Utilities","title":"Utilities","text":"UnfoldMakie.RelativeAxis\nUnfoldMakie.eeg_topoplot_series\nUnfoldMakie.eeg_topoplot_series!\nUnfoldMakie.config_kwargs!\nUnfoldMakie.eeg_matrix_to_dataframe\nUnfoldMakie.rel_to_abs_bbox\nUnfoldMakie.to_positions\nUnfoldMakie.df_timebin\nUnfoldMakie.cart3d_to_spherical\nUnfoldMakie.valType_to_symbol","category":"page"},{"location":"helper/#UnfoldMakie.RelativeAxis","page":"Utilities","title":"UnfoldMakie.RelativeAxis","text":"ax = RelativeAxis(figlike, p::NTuple{4, Float64}; kwargs...)\n\nReturns an axis which's position is relative to a GridLayout Element (via BBox) and not relative to the Scene (default Axis(..., bbox=BBox()) behavior)\n\np::NTuple{4,Float64}: Give the relative position to the GridPosition, left:right; bottom:up, typical numbers betwen 0 and 1. E.g. (0.25, 0.75, 0.25, 0.75) would center an Axis inside that GridPosition\n\nkwargs... are pasted into Axis\n\nf = Figure() ax = RelativeAxis(f[1,2], (0.25, 0.75, 0.25, 0.75))\t # returns Axis centered within f[1,2]\n\n\n\n\n\n","category":"type"},{"location":"helper/#UnfoldMakie.eeg_topoplot_series","page":"Utilities","title":"UnfoldMakie.eeg_topoplot_series","text":"function eegtopoplotseries(data::DataFrame, Δbin; y=:estimate, label=:label, col=:time, row=nothing, figure = NamedTuple(), combinefun=mean, rowlabels = false, collabels = false, topoplot_attributes... )\n\nPlot a series of topoplots. The function automatically takes the combinefun=mean over the :time column of data in Δbin steps.\n\nThe 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)).\nΔ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.\nThe 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\n\nto 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.\n\nThe 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..).\nrow_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).\n\nExamples\n\nDesc\n\njulia > df = DataFrame(:erp => repeat(1:63, 100), :time => repeat(1:20, 5 * 63), :label => repeat(1:63, 100)) # fake data\njulia > 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\njulia > pos = [Point2.(pos[k, 1], pos[k, 2]) for k in 1:size(pos, 1)]\njulia > eeg_topoplot_series(df, 5; positions=pos)\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.eeg_topoplot_series!","page":"Utilities","title":"UnfoldMakie.eeg_topoplot_series!","text":"eegtopoplotseries!(fig, data::DataFrame, Δbin; kwargs..) In place plotting of topoplot series see eegtopoplotseries(data, Δbin) for help\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.config_kwargs!","page":"Utilities","title":"UnfoldMakie.config_kwargs!","text":"Takes a kwargs named tuple of Key => NamedTuple and merges the fields with the defaults\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.eeg_matrix_to_dataframe","page":"Utilities","title":"UnfoldMakie.eeg_matrix_to_dataframe","text":"Helper function converting a matrix (channel x times) to a tidy dataframe with columns :estimate, :time and :label\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.rel_to_abs_bbox","page":"Utilities","title":"UnfoldMakie.rel_to_abs_bbox","text":"reltoabs_bbox(org,rel)\n\nTakes a rectangle org and applies the relative transformation tuple rel Returns a Makie.BBox\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.to_positions","page":"Utilities","title":"UnfoldMakie.to_positions","text":"topositions(x,y,z;sphere=[0,0,0.]) topositions(pos::AbstractMatrix;sphere=[0,0,0.]) Projects 3D electrode positions to a 2D layout.\n\nThe matrix case, assumes size(pos) = (3,nChannels) Re-implementation of the MNE algorithm.\n\nTipp: You can directly get positions from an MNE object after loading PyMNE and thus activating the UnfoldMakie PyMNE extension\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.df_timebin","page":"Utilities","title":"UnfoldMakie.df_timebin","text":"function dftimebin(df, Δbin; coly=:erp, fun=mean, grouping=[]) Split or combine dataframe according to equally spaced time bins\n\ndf AbstractTable with columns :time and col_y (default :erp), and all columns in grouping;\nΔbin bin size in :time units;\ncol_y default :erp, the column to combine over (with fun);\nfun function to combine, default is mean;\ngrouping (vector of symbols/strings) default empty vector, columns to group the data by before aggregating. Values of nothing are ignored.\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.cart3d_to_spherical","page":"Utilities","title":"UnfoldMakie.cart3d_to_spherical","text":"convert x/y/z electrode montage positions to spherical coordinate representation. output is a matrix\n\n\n\n\n\n","category":"function"},{"location":"helper/#UnfoldMakie.valType_to_symbol","page":"Utilities","title":"UnfoldMakie.valType_to_symbol","text":"Val{:bu}() to => :bu\n\n\n\n\n\n","category":"function"},{"location":"api/","page":"API","title":"API","text":"Modules = [UnfoldMakie]\nOrder = [:function]","category":"page"},{"location":"api/#UnfoldMakie.cart3d_to_spherical-Tuple{Any, Any, Any}","page":"API","title":"UnfoldMakie.cart3d_to_spherical","text":"convert x/y/z electrode montage positions to spherical coordinate representation. output is a matrix\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.config_kwargs!-Tuple{PlotConfig}","page":"API","title":"UnfoldMakie.config_kwargs!","text":"Takes a kwargs named tuple of Key => NamedTuple and merges the fields with the defaults\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.df_timebin-Tuple{Any, Any}","page":"API","title":"UnfoldMakie.df_timebin","text":"function dftimebin(df, Δbin; coly=:erp, fun=mean, grouping=[]) Split or combine dataframe according to equally spaced time bins\n\ndf AbstractTable with columns :time and col_y (default :erp), and all columns in grouping;\nΔbin bin size in :time units;\ncol_y default :erp, the column to combine over (with fun);\nfun function to combine, default is mean;\ngrouping (vector of symbols/strings) default empty vector, columns to group the data by before aggregating. Values of nothing are ignored.\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.eeg_matrix_to_dataframe-Tuple{Any, Any}","page":"API","title":"UnfoldMakie.eeg_matrix_to_dataframe","text":"Helper function converting a matrix (channel x times) to a tidy dataframe with columns :estimate, :time and :label\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.eeg_topoplot_series!-Tuple{Any, DataFrame, Any}","page":"API","title":"UnfoldMakie.eeg_topoplot_series!","text":"eegtopoplotseries!(fig, data::DataFrame, Δbin; kwargs..) In place plotting of topoplot series see eegtopoplotseries(data, Δbin) for help\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.eeg_topoplot_series-Tuple{DataFrame, Any}","page":"API","title":"UnfoldMakie.eeg_topoplot_series","text":"function eegtopoplotseries(data::DataFrame, Δbin; y=:estimate, label=:label, col=:time, row=nothing, figure = NamedTuple(), combinefun=mean, rowlabels = false, collabels = false, topoplot_attributes... )\n\nPlot a series of topoplots. The function automatically takes the combinefun=mean over the :time column of data in Δbin steps.\n\nThe 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)).\nΔ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.\nThe 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\n\nto 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.\n\nThe 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..).\nrow_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).\n\nExamples\n\nDesc\n\njulia > df = DataFrame(:erp => repeat(1:63, 100), :time => repeat(1:20, 5 * 63), :label => repeat(1:63, 100)) # fake data\njulia > 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\njulia > pos = [Point2.(pos[k, 1], pos[k, 2]) for k in 1:size(pos, 1)]\njulia > eeg_topoplot_series(df, 5; positions=pos)\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_butterfly-Tuple{DataFrame}","page":"API","title":"UnfoldMakie.plot_butterfly","text":"Plot Butterfly\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = NamedTuple() - use kwargs... of Makie.Axis \n\nlayout = (showLegend = false, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t)) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:channel, :channels, :trial, :trials), positions = (:pos, :positions, :position, :topoPositions, :x, nothing), labels = (:labels, :label, :topoLabels, :sensor, nothing)) \n\nvisual = (colormap = :roma,) - use kwargs... of Makielines \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of AlgebraOfGraphics.colobar! \n\nkey-word arguments\n\ntopomarkersize (Real, 10) - change the size of the markers, topoplot-inlay electrodes\ntopowidth (Real, 0.25) - change the size of the inlay topoplot width\ntopoheigth (Real, 0.25) - change the size of the inlay topoplot height\n\nsee also plot_erp\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_circulareegtopoplot-Tuple{DataFrame}","page":"API","title":"UnfoldMakie.plot_circulareegtopoplot","text":"plot_circulareegtopoplot(plotData::DataFrame;kwargs...)\nplot_circulareegtopoplot!(figlike, plotData::DataFrame;kwargs...)\n\nPlot a circular EEG topoplot.\n\nArguments:\n\nfiglike::Union{GridPosition, Figure}: Figure or GridPosition that the plot should be drawn into\nplotData::DataFrame: Dataframe with keys for data (looks for :y,:yhat, :estimate, and :position (looks for :pos, :positions, :position), \npredictor (optional; default :predictor) the circular predictor value, defines position of topoplot, is mapped around predictorBounds\npredictorBounds: Default: [0,360] - The bounds of the predictor. This is relevant for the axis labels.\ncenterlabel: default \"\", the text in the center of the cricle\npositions (nothing) - positions for the plot_topoplot\nlabels (nothing) - labels for the plot_topoplot\nkwargs...: Additional styling behavior, see below.\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = (aspect = Makie.DataAspect(), label = \"\") - use kwargs... of Makie.Axis \n\nlayout = (showLegend = false, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ()) \n\nmapping = (x = (nothing,), y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing)) \n\nvisual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), labelscatter = true, labeltext = true, boundinggeometry = GeometryBasics.Circle) - *use kwargs... of [``Topoplot.eegtopoplot``](@ref)* \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false, label = \"Voltage [µV]\", colormap = Makie.Reverse{Symbol}(:RdBu)) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nA figure containing the circular topoplot at given layout position\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_designmatrix-Tuple{Unfold.DesignMatrix}","page":"API","title":"UnfoldMakie.plot_designmatrix","text":"plot_designmatrix(plotData::Unfold.DesignMatrix;kwargs...)\n\nPlot a designmatrix. \n\nArguments:\n\nplotData::Unfold.DesignMatrix: Data for the plot visualization.\n\nkwargs\n\nstandardizeData: (bool,true) - Indicating whether the data is standardized by pointwise division of the data with its sampled standard deviation.\nsortData: (bool, true) - Indicating whether the data is sorted; using sortslices() of Base Julia. \nxTicks: (nothing) \n\nIndicating the number of labels on the x-axis. Behavior if specified in configuration:\n\nxTicks = 0: no labels are placed.\nxTicks = 1: first possible label is placed.\nxTicks = 2: first and last possible labels are placed.\n2 < xTicks < number of labels: Equally distribute the labels.\nxTicks ≥ number of labels: all labels are placed.\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = (xticklabelrotation = 0.39269908169872414,) - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y)) \n\nvisual = (colormap = :roma,) - use kwargs... of Makieheatmap \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nA figure displaying the designmatrix. \n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_erp-Tuple{DataFrame}","page":"API","title":"UnfoldMakie.plot_erp","text":"plot_erp!(f::Union{GridPosition, Figure}, plotData::DataFrame; kwargs...)\nplot_erp(plotData::DataFrame; kwargs...)\n\nPlot an ERP plot.\n\nArguments:\n\nf::Union{GridPosition, Figure}: Figure or GridPosition that the plot should be drawn into\nplotData::DataFrame: Data for the line plot visualization.\nkwargs...: Additional styling behavior. Often used: plot_erp(df; mapping=(; color=:coefname, col=:conditionA))\n\nkwargs (...; ...):\n\ncategoricalColor (bool, true) - Indicates whether the column referenced in mapping.color should be used nonnumerically.\ncategoricalGroup (bool, true) - Indicates whether the column referenced in mapping.group should be used nonnumerically.\ntopoLegend (bool, false) - Indicating whether a topo plot is used as a legend.\nstderror (bool, false) - Indicating whether the plot should show a colored band showing lower and higher estimates based on the stderror. \npvalue (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\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = NamedTuple() - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t)) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:color, :coefname, nothing)) \n\nvisual = (colormap = :roma,) - use kwargs... of Makielines \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of AlgebraOfGraphics.colobar! \n\nReturn Value:\n\nf - Figure() or the inputed f\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_new-Tuple{}","page":"API","title":"UnfoldMakie.plot_new","text":"plot_new() -> String\n\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = NamedTuple() - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, useColorbar = false, hidespines = (:r, :t)) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:color, :coefname, nothing)) \n\nvisual = (colormap = :roma,) - use kwargs... of Makielines \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of AlgebraOfGraphics.colobar! \n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_parallelcoordinates-Tuple{DataFrame, Vector{Int64}}","page":"API","title":"UnfoldMakie.plot_parallelcoordinates","text":"plot_parallelcoordinates!(f::Union{GridPosition, Figure}, plotData::DataFrame, config::PlotConfig; channels::Vector{Int64})\n\nPlot a PCP (parallel coordinates plot).\n\nArguments:\n\nf::Union{GridPosition, Figure}: Figure or GridPosition that the plot should be drawn into\nplotData::DataFrame: Data for the plot visualization.\nconfig::PlotConfig: Instance of PlotConfig being applied to the visualization.\nchannels::Vector{Int64}: vector with all the channels representing an axis used in the PCP in given order.\n\nPCP 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\n\npc_aspect_ratio Default : 0.55\n\npc_right_padding Default : 15\n\npc_left_padding Default : 25\n\npc_top_padding Default : 26\n\npc_bottom_padding Default : 16\n\npc_tick_label_size Default : 14\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = NamedTuple() - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = :channel, ylabelFromMapping = :y, useColorbar = false, hidespines = (), hidedecorations = (label = false,)) \n\nmapping = (x = (:time,), y = (:estimate, :yhat, :y), channel = :channel, category = :category, time = :time) \n\nvisual = (colormap = :roma,) - use kwargs... of Makielines \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nThe input f\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_topoplot-Tuple{Union{DataFrame, Vector{Float32}}}","page":"API","title":"UnfoldMakie.plot_topoplot","text":"plot_topoplot!(f::Union{GridPosition, Figure}, plotData, ; positions=nothing, labels=nothing,kwargs...)\nplot_topoplot(plotData,; positions=nothing, labels=nothing,kwargs...)\n\nPlot a topo plot.\n\nArguments:\n\nf::Union{GridPosition, Figure}: Figure or GridPosition (e.g. f[2, 3]) that the plot should be drawn into. New axis is created.\nplotData::Union{DataFrame, Vector{Float32}}: Data for the plot visualization.\npositions::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.\nlabels::Vector{String}=nothing: labels used if plotData is no DataFrame.\n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = (aspect = Makie.DataAspect(),) - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ()) \n\nmapping = (x = (nothing,), y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing)) \n\nvisual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), labelscatter = true, labeltext = true, boundinggeometry = GeometryBasics.Circle) - *use kwargs... of [``Topoplot.eegtopoplot``](@ref)* \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nA figure displaying the topo plot.\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.plot_topoplotseries-Tuple{DataFrame, Real}","page":"API","title":"UnfoldMakie.plot_topoplotseries","text":"plot_topoplotseries!(f::Union{GridPosition, Figure}, plotData::DataFrame,Δbin::Real;kwargs...)\nplot_topoplotseries!(plotData::DataFrame, Δbin::Real;kwargs...)\n\nMultiple miniature topoplots in regular distances \n\nArguments:\n\nf::Union{GridPosition, Figure}: Figure or GridPosition that the plot should be drawn into\nplotData::DataFrame: DataFrame with data, needs a time column\nΔbin::Real: A number for how large one bin should be. Δbin is in units of the plotData.time column\ncombinefun (default mean) can be used to specify how the samples within Δbin are combined.\nrasterize_heatmaps (deault true) - enforce rasterization of the plot heatmap when saving in svg format.\n\nThis 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.\n\ncol_labels, row_labels - shows column and row labels. \n\nShared plot configuration options\n\nThe 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.\n\nfigure = NamedTuple() - use kwargs... of Makie.Figure \n\naxis = (aspect = Makie.DataAspect(),) - use kwargs... of Makie.Axis \n\nlayout = (showLegend = true, legendPosition = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, useColorbar = true, hidespines = (), hidedecorations = ()) \n\nmapping = (x = (nothing,), y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing), col = (:time,), row = (nothing,)) \n\nvisual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), labelscatter = true, labeltext = false, boundinggeometry = GeometryBasics.Circle) - *use kwargs... of [``Topoplot.eegtopoplot``](@ref)* \n\nlegend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs... of Makie.Legend \n\ncolorbar = (vertical = true, tellwidth = true, tellheight = false) - use kwargs... of Makie.Colorbar \n\nReturn Value:\n\nThe input f\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.rel_to_abs_bbox-Tuple{Any, Any}","page":"API","title":"UnfoldMakie.rel_to_abs_bbox","text":"reltoabs_bbox(org,rel)\n\nTakes a rectangle org and applies the relative transformation tuple rel Returns a Makie.BBox\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.to_positions-Tuple{AbstractMatrix}","page":"API","title":"UnfoldMakie.to_positions","text":"topositions(x,y,z;sphere=[0,0,0.]) topositions(pos::AbstractMatrix;sphere=[0,0,0.]) Projects 3D electrode positions to a 2D layout.\n\nThe matrix case, assumes size(pos) = (3,nChannels) Re-implementation of the MNE algorithm.\n\nTipp: You can directly get positions from an MNE object after loading PyMNE and thus activating the UnfoldMakie PyMNE extension\n\n\n\n\n\n","category":"method"},{"location":"api/#UnfoldMakie.valType_to_symbol-Tuple{Any}","page":"API","title":"UnfoldMakie.valType_to_symbol","text":"Val{:bu}() to => :bu\n\n\n\n\n\n","category":"method"},{"location":"api/","page":"API","title":"API","text":"Internally, we use a PlotConfig struct to keep track of common plot options, in order to have a similar API to all functions","category":"page"},{"location":"api/","page":"API","title":"API","text":"PlotConfig","category":"page"},{"location":"api/#UnfoldMakie.PlotConfig","page":"API","title":"UnfoldMakie.PlotConfig","text":"PlotConfig()\nholds various different fields, that can modify various different plotting aspects.\n\n\n\n\n\n","category":"type"},{"location":"how_to/mult_vis_in_fig/#ht_mvf","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"","category":"section"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"using UnfoldMakie\nusing CairoMakie\nusing DataFramesMeta\nusing UnfoldSim\nusing Unfold\nusing MakieThemes\nset_theme!(theme_ggthemr(:fresh)) # nicer defaults - should maybe be default?\n","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"include(\"../../example_data.jl\")\nd_topo, positions = example_data(\"TopoPlots.jl\")\nuf_deconv = example_data(\"UnfoldLinearModelContinuousTime\")\nuf = example_data(\"UnfoldLinearModel\")\nresults = coeftable(uf)\nuf_5chan = example_data(\"UnfoldLinearModelMultiChannel\")\nd_singletrial, _ = UnfoldSim.predef_eeg(; return_epoched=true)\ntimes = -0.099609375:0.001953125:1.0\nnothing #hide","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"This section discusses how users can incorporate multiple plots into a single figure.","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"By using the !-version of the plotting function and inserting a grid position instead of an entire figure, we can create multiple coordinated views.","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"We start by creating a figure with Makie.Figure. ","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"f = Figure()","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"Now any plot can be added to f by placing a grid position, such as f[1,1].","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"\nf = Figure()\nplot_erp!(f[1, 1], coeftable(uf_deconv))\nplot_erp!(f[1, 2], effects(Dict(:condition => [\"car\", \"face\"]), uf_deconv), mapping=(; color=:condition))\nplot_butterfly!(f[2, 1:2], d_topo; positions=positions)\n\nf","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"Using the data from the tutorials, we can create a large image with any type of plot.","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"With so many plots at once, it's tempting to set a fixed resolution in your image to order the plots evenly (code below).","category":"page"},{"location":"how_to/mult_vis_in_fig/","page":"Include multiple Visualizations in one Figure","title":"Include multiple Visualizations in one Figure","text":"\nf = Figure(resolution=(2000, 2000))\n\nplot_butterfly!(f[1, 1:3], d_topo; positions=positions)\n\npvals = DataFrame(\n from=[0.1, 0.15],\n to=[0.2, 0.5],\n # if coefname not specified, line should be black\n coefname=[\"(Intercept)\", \"category: face\"]\n)\nplot_erp!(f[2, 1:2], results, \n categoricalColor=false,\n categoricalGroup=false,\n pvalue=pvals,\n stderror=true)\n\n\nplot_designmatrix!(f[2, 3], designmatrix(uf))\n\nplot_topoplot!(f[3, 1], collect(1:64); positions=positions, visual=(; colormap=:viridis))\nplot_topoplotseries!(f[4, 1:3], d_topo, 0.1; positions=positions, mapping=(; label=:channel))\n\nres_effects = effects(Dict(:continuous => -5:0.5:5), uf_deconv)\n\nplot_erp!(f[2, 4:5], res_effects;\n mapping=(; y=:yhat, color=:continuous, group=:continuous),\n showLegend=true,\n categoricalColor=false,\n categoricalGroup=true,\n legend=(; nbanks=2),\n layout=(; legendPosition=:right))\n\nplot_parallelcoordinates!(f[3, 2:3], uf_5chan, [1, 2, 3, 4, 5]; mapping=(; color=:coefname), layout=(; legendPosition=:bottom))\n\nplot_erpimage!(f[1, 4:5], times, d_singletrial)\nplot_circulareegtopoplot!(f[3:4, 4:5], d_topo[in.(d_topo.time, Ref(-0.3:0.1:0.5)), :];\n positions=positions, predictor=:time,predictorBounds=[-0.3, 0.5])\n\nf","category":"page"},{"location":"tutorials/topoplotseries/#tpseries_vis","page":"Topo Plot Series","title":"Topo Plot SeriesVisualization","text":"","category":"section"},{"location":"tutorials/topoplotseries/#Include-used-Modules","page":"Topo Plot Series","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie\nusing TopoPlots","category":"page"},{"location":"tutorials/topoplotseries/#Plot-Topo-Plots-Series","page":"Topo Plot Series","title":"Plot Topo Plots Series","text":"","category":"section"},{"location":"tutorials/topoplotseries/#Giving-the-Data","page":"Topo Plot Series","title":"Giving the Data","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"In case you do not already have data, you can get example data from the TopoPlots module. You can do it like this:","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"data, positions = TopoPlots.example_data()\ndf = UnfoldMakie.eeg_matrix_to_dataframe(data[:,:,1], string.(1:length(positions)));\nnothing #hide","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"Δbin = 80\nplot_topoplotseries(df, Δbin; positions = positions)","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"With colorbar:","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"plot_topoplotseries(df, Δbin; positions=positions, layout = (; useColorbar=true))","category":"page"},{"location":"tutorials/topoplotseries/#Positions","page":"Topo Plot Series","title":"Positions","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"You can give either positions, or labels. If both are provided, positions have priority","category":"page"},{"location":"tutorials/topoplotseries/#plot_toposeries(...;-mapping(;-keyvalue))","page":"Topo Plot Series","title":"plot_toposeries(...; mapping=(; key=value))","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"mapping=(: y=(:estimate, :yhat, :y))","category":"page"},{"location":"tutorials/topoplotseries/#visual(;)","page":"Topo Plot Series","title":"visual=(;)","text":"","category":"section"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"label_text (boolean, false) Indicates whether label should drawn next to their position. The labels have to be given into the function seperately:","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"important: Important\ncurrently bugged","category":"page"},{"location":"tutorials/topoplotseries/","page":"Topo Plot Series","title":"Topo Plot Series","text":"label_scatter (boolean, true) - Indicates whether the dots should be drawn at the given positions.","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"EditURL = \"../../../literate/reference/positions.jl\"","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"using UnfoldMakie\nusing CairoMakie\nusing TopoPlots\nusing PyMNE","category":"page"},{"location":"generated/reference/positions/#get-MNE-positions","page":"Convert 3D positions / montages to 2D layouts","title":"get MNE-positions","text":"","category":"section"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"Generate a fake MNE structure taken from mne documentation","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"biosemi_montage = PyMNE.channels.make_standard_montage(\"biosemi64\")\nn_channels = length(biosemi_montage.ch_names)\nfake_info = PyMNE.create_info(ch_names=biosemi_montage.ch_names, sfreq=250.,\n ch_types=\"eeg\")\ndata = rand(n_channels,1) * 1e-6\nfake_evoked = PyMNE.EvokedArray(data, fake_info)\nfake_evoked.set_montage(biosemi_montage)\n\npos = to_positions(fake_evoked)","category":"page"},{"location":"generated/reference/positions/#project-from-3D-electrode-locations-to-2D","page":"Convert 3D positions / montages to 2D layouts","title":"project from 3D electrode locations to 2D","text":"","category":"section"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"pos3d = hcat(values(pyconvert(Dict,biosemi_montage.get_positions()[\"ch_pos\"]))...)\n\npos2 = to_positions(pos3d)\n\nf = Figure(resolution=(600,300))\nscatter(f[1,1],pos3d[1:2,:])\nscatter(f[1,2],pos2)\nf","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"as one can see, the \"naive\" transform of just dropping the third dimension doesnt really work (left). We rather have to project the chanels to a sphere and unfold it (right)","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"","category":"page"},{"location":"generated/reference/positions/","page":"Convert 3D positions / montages to 2D layouts","title":"Convert 3D positions / montages to 2D layouts","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/parallelcoordinates/#pcp_vis","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Here we discuss parallel coordinates plot (PCP) visualization. ","category":"page"},{"location":"tutorials/parallelcoordinates/#Include-used-Modules","page":"Parallel Coordinates Plot","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie","category":"page"},{"location":"tutorials/parallelcoordinates/#Data","page":"Parallel Coordinates Plot","title":"Data","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"We use the test data of erpcore-N170.jld2.","category":"page"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"include(\"../../example_data.jl\")\nresults_plot, positions = example_data();","category":"page"},{"location":"tutorials/parallelcoordinates/#Plot-PCPs","page":"Parallel Coordinates Plot","title":"Plot PCPs","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"plot_parallelcoordinates(results_plot, [5,3,2]; # this selects channel 5,3 & 2 \n mapping = (color = :coefname, y = :estimate))","category":"page"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"important: Important\nthe following is still outdated...","category":"page"},{"location":"tutorials/parallelcoordinates/#Column-Mappings-for-PCPs","page":"Parallel Coordinates Plot","title":"Column Mappings for PCPs","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Since PCPs use a DataFrame as an input, the library needs to know the names of the columns used for plotting.","category":"page"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"While there are multiple default values that are checked in that order if they exist in the DataFrame, a custom name might need to be choosen for:","category":"page"},{"location":"tutorials/parallelcoordinates/#y","page":"Parallel Coordinates Plot","title":"y","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Default is (:y, :estimate, :yhat).","category":"page"},{"location":"tutorials/parallelcoordinates/#channel","page":"Parallel Coordinates Plot","title":"channel","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Default is :channel.","category":"page"},{"location":"tutorials/parallelcoordinates/#color","page":"Parallel Coordinates Plot","title":"color","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"XXX Default is :coef.","category":"page"},{"location":"tutorials/parallelcoordinates/#time","page":"Parallel Coordinates Plot","title":"time","text":"","category":"section"},{"location":"tutorials/parallelcoordinates/","page":"Parallel Coordinates Plot","title":"Parallel Coordinates Plot","text":"Default is :time.","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"EditURL = \"../../../literate/tutorials/erp.jl\"","category":"page"},{"location":"generated/tutorials/erp/#lp_vis","page":"ERP plot","title":"Line Plot Visualization","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Here we discuss line plot visualization. Make sure you have looked into the installation instructions.","category":"page"},{"location":"generated/tutorials/erp/#Include-used-Modules","page":"ERP plot","title":"Include used Modules","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie\nusing DataFramesMeta\nusing UnfoldSim\nusing UnfoldMakie","category":"page"},{"location":"generated/tutorials/erp/#Setup","page":"ERP plot","title":"Setup","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Let's generate some data and fit a model of a 2-level categorical and a continuous predictor with interaction.","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"data, evts = UnfoldSim.predef_eeg(; noiselevel = 12, return_epoched = true)\ndata = reshape(data, (1, size(data)...))\nf = @formula 0 ~ 1 + condition + continuous\nse_solver = (x, y) -> Unfold.solver_default(x, y, stderror = true);\n\nm = fit(\n UnfoldModel,\n Dict(Any => (f, range(0, step = 1 / 100, length = size(data, 2)))),\n evts,\n data,\n solver = se_solver,\n)\nresults = coeftable(m)\nres_effects = effects(Dict(:continuous => -5:0.5:5), m);\nnothing #hide","category":"page"},{"location":"generated/tutorials/erp/#Plot-the-results","page":"ERP plot","title":"Plot the results","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp(results; :stderror => true,)","category":"page"},{"location":"generated/tutorials/erp/#Column-Mappings-for-Line-Plots","page":"ERP plot","title":"Column Mappings for Line Plots","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp use a DataFrame as an input, the library needs to know the names of the columns used for plotting.","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"There are multiple default values, that are checked in that order if they exist in the DataFrame, a custom name can be chosen using plot_erp(...;mapping=(; :y=:myEstimate)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":":x Default is (:x, :time). :y Default is (:y, :estimate, :yhat). :color Default is (:color, :coefname).","category":"page"},{"location":"generated/tutorials/erp/#Configuration-for-Line-Plots","page":"ERP plot","title":"Configuration for Line Plots","text":"","category":"section"},{"location":"generated/tutorials/erp/#key-values","page":"ERP plot","title":"key values","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp(...; =,...).","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"categoricalColor (boolean, true) - in case of numeric :color column, is color a continuous or categorical variable?\ncategoricalGroup (boolean, true) - in case of numeric :group column, treat :group as categorical variable by default\nstderror (boolean, false) - add an error-ribbon based on the :stderror column\npvalue (see below)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Using some general configurations we can pretty up the default visualization. Here we use the following configuration:","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp(\n res_effects;\n mapping = (; y = :yhat, color = :continuous, group = :continuous),\n legend = (; nbanks = 2),\n layout = (; legendPosition = :right),\n showLegend = true, categoricalColor = false, categoricalGroup = true,\n)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"In the following we will use this \"pretty\" line plot as a basis for looking into configuration options.","category":"page"},{"location":"generated/tutorials/erp/#pvalue-(array)","page":"ERP plot","title":"pvalue (array)","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"important: Important\nthis is currently broken!","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Is an array of p-values. If array not empty, plot shows colored lines under the plot representing the p-values. Default is [] (an empty array). Shown below is an example in which pvalue are given: pvals = DataFrame(","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"#\t\tfrom=[0.1,0.3],\n#\t\tto=[0.5,0.7],\n#\t\tcoefname=[\"(Intercept)\",\"condition: face\"] # if coefname not specified, line should be black\n#\t)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"plot_erp(results; :pvalue=>pvals)","category":"page"},{"location":"generated/tutorials/erp/#stderror-(boolean)","page":"ERP plot","title":"stderror (boolean)","text":"","category":"section"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"Indicating whether the plot should show a colored band showing lower and higher estimates based on the stderror. Default is false.","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"previously we showed :stderror- but low/high is possible as well`","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"results.se_low = results.estimate .- 0.5\nresults.se_high = results.estimate .+ 0.15\nplot_erp(select(results, Not(:stderror)); stderror = true)","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"note: Note\nas in the above code,:stderror has precedence over :se_low/:se_high","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"","category":"page"},{"location":"generated/tutorials/erp/","page":"ERP plot","title":"ERP plot","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/erpimage/#erpi_vis","page":"ERP Image","title":"ERP Image Visualization","text":"","category":"section"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"Here we discuss ERP image visualization. Make sure you have looked into the installation instructions.","category":"page"},{"location":"tutorials/erpimage/#Include-used-Modules","page":"ERP Image","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"using Unfold\nusing UnfoldMakie\nusing CairoMakie\nusing UnfoldSim\ninclude(\"../../example_data.jl\")","category":"page"},{"location":"tutorials/erpimage/#Plot-ERP-Images","page":"ERP Image","title":"Plot ERP Images","text":"","category":"section"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"The following code will result in the default configuration. ","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"data, evts = UnfoldSim.predef_eeg(; noiselevel=10, return_epoched=true)\nplot_erpimage(data)","category":"page"},{"location":"tutorials/erpimage/#Column-Mappings-for-ERP-Images","page":"ERP Image","title":"Column Mappings for ERP Images","text":"","category":"section"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"Since ERP images use a Matrix as an input, the library does not need any informations about the mapping.","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"erpBlur (number, 10) - Is a number indicating how much blur is applied to the image; using Gaussian blur of the ImageFiltering module. Negative values deactivate the blur.\nsortvalues - Indicating whether the data is sorted; using sortperm() of Base Julia ","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"(sortperm() computes a permutation of the array's indices that puts the array into sorted order). ","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"meanPlot (bool, false) - Indicating whether the plot should add a line plot below the ERP image, showing the mean of the data. If limits are set in the axis values both plots will be aligned.","category":"page"},{"location":"tutorials/erpimage/","page":"ERP Image","title":"ERP Image","text":"plot_erpimage(data;\n meanPlot = true,\n colorbar = (label = \"Voltage [µV]\",),\n visual = (colormap = :viridis, colorrange = (-40, 40)))\n","category":"page"},{"location":"tutorials/butterfly/#bfp_vis","page":"Butterfly Plot","title":"Butterfly Plot Visualization","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Here we discuss butterfly plot visualization. Make sure you have looked into the installation instructions.","category":"page"},{"location":"tutorials/butterfly/#Include-used-Modules","page":"Butterfly Plot","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"using UnfoldMakie\nusing Unfold\nusing CairoMakie\nusing DataFrames","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Note that DataFramesMeta is also used here in order to be able to use @subset for testing (filtering).","category":"page"},{"location":"tutorials/butterfly/#Data","page":"Butterfly Plot","title":"Data","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"We filter the data to make it more clearly represented:","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"include(\"../../example_data.jl\")\ndf, pos = example_data(\"TopoPlots.jl\")\nfirst(df, 3)","category":"page"},{"location":"tutorials/butterfly/#Plot-Butterfly-Plots","page":"Butterfly Plot","title":"Plot Butterfly Plots","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"The following code will plot the default butterfly plot","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"plot_butterfly(df)","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"or if you provide the channel positions:","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"plot_butterfly(df; positions=pos)","category":"page"},{"location":"tutorials/butterfly/#Column-Mappings-for-Butterfly-Plots","page":"Butterfly Plot","title":"Column Mappings for Butterfly Plots","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Since butterfly plots use a DataFrame as input, the library needs to know the names of the columns used for plotting. You can set these mapping values by calling plot_butterfly(...; mapping=(; :x=:time,)), that is, by specifying a NamedTuple (note the ; right after the opening parentheses).","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"While there are several default values that will be checked in that order if they exist in the DataFrame, a custom name may need to be chosen:","category":"page"},{"location":"tutorials/butterfly/#x","page":"Butterfly Plot","title":"x","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Default is (:x, :time).","category":"page"},{"location":"tutorials/butterfly/#y","page":"Butterfly Plot","title":"y","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Default is (:y, :estimate, :yhat).","category":"page"},{"location":"tutorials/butterfly/#labels","page":"Butterfly Plot","title":"labels","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Default is (:labels, :label, :topoLabels, :sensor, :nothing)","category":"page"},{"location":"tutorials/butterfly/#Configurations-for-Butterfly-Plots","page":"Butterfly Plot","title":"Configurations for Butterfly Plots","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Here we look into possible options for configuring the butterfly plot visualization using (...; =, ...). This is the list of unique configuration (key values):","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"topoLegend (boolean)","category":"page"},{"location":"tutorials/butterfly/#topoLegend-(boolean)","page":"Butterfly Plot","title":"topoLegend (boolean)","text":"","category":"section"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Indicating whether the topo legend is displayed. Default is true.","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"For more general options look into the Plot Configuration section of the documentation.","category":"page"},{"location":"tutorials/butterfly/","page":"Butterfly Plot","title":"Butterfly Plot","text":"Since the configurations for line plots can be applied to butterfly plots as well. Here you can find the configurations for line plots, ","category":"page"},{"location":"tutorials/topoplot/#tp_vis","page":"Topo Plot","title":"Topo Plot Visualization","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Here we discuss topo plot visualization. Make sure you have looked into the installation instructions.","category":"page"},{"location":"tutorials/topoplot/#Include-used-Modules","page":"Topo Plot","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie\nusing TopoPlots","category":"page"},{"location":"tutorials/topoplot/#Plot-Topo-Plots","page":"Topo Plot","title":"Plot Topo Plots","text":"","category":"section"},{"location":"tutorials/topoplot/#Providing-the-Data","page":"Topo Plot","title":"Providing the Data","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"data, positions = TopoPlots.example_data()","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"We select one datapoint, and the first enry of dimension 3 (the mean estimate, the others are p-value and std)","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"plot_topoplot(data[:,340,1]; positions = positions)","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"using DataFrames\ndf = DataFrame(:estimate => data[:,340,1])\nplot_topoplot(df; positions = positions)","category":"page"},{"location":"tutorials/topoplot/#Giving-the-Positions","page":"Topo Plot","title":"Giving the Positions","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Since the topo plot needs the positions of the sensors they have to be put into the drawing function. But there are multiple options (In order of prioritization):","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Giving the positions directly: plot_topoplot(...; positions=[...])\nGiving the labels of the sensors: plot_topoplot(...; labels=[...])","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"To get the positions from the labels we use a database.","category":"page"},{"location":"tutorials/topoplot/#Column-Mappings-for-Topo-Plots","page":"Topo Plot","title":"Column Mappings for Topo Plots","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"When using topo plots with a DataFrame as an input, the library needs to know the names of the columns used for plotting. This is specified using the mapping=(;) kwargs.","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"While there are multiple default values, that are checked in that order if they exist in the DataFrame, a custom name might need to be choosen for:","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Note that only one of positions or labels have to be set to draw a topo plot. If both are set, positions takes precedence, labels might be used for labelling electrodes in TopoPlots.jl","category":"page"},{"location":"tutorials/topoplot/#(...,mapping(;))","page":"Topo Plot","title":"(...,mapping=(;))","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":":y plotting function looks in the default columns of mapping","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"cfgDefault = UnfoldMakie.PlotConfig()\ncfgDefault.mapping.y","category":"page"},{"location":"tutorials/topoplot/#label_text-(boolean)","page":"Topo Plot","title":"label_text (boolean)","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Indicates whether label should drawn next to their position. Obviously the labels have to be provided: plot_topoplot(...; labels=[...])","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"plot_topoplot(...; visual=(; label_text=true))","category":"page"},{"location":"tutorials/topoplot/#label_scatter-(boolean)","page":"Topo Plot","title":"label_scatter (boolean)","text":"","category":"section"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"Indicates whether the dots should be drawn at the given positions.","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"plot_topoplot(...; visual=(; label_scatter=true))","category":"page"},{"location":"tutorials/topoplot/","page":"Topo Plot","title":"Topo Plot","text":"data, positions = TopoPlots.example_data()\nplot_topoplot(data[1:4,340,1]; visual = (; label_scatter = false), labels=[\"O1\", \"F2\", \"F3\", \"P4\"])","category":"page"},{"location":"tutorials/designmatrix/#dm_vis","page":"Designmatrix","title":"Designmatrix Visualization","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"Here we discuss designmatrix visualization. Make sure you have looked into the installation instructions section. ","category":"page"},{"location":"tutorials/designmatrix/#Include-used-Modules","page":"Designmatrix","title":"Include used Modules","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"The following modules are necessary for following this tutorial:","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"using Unfold\nusing UnfoldMakie\nusing DataFrames\nusing CairoMakie","category":"page"},{"location":"tutorials/designmatrix/#Data","page":"Designmatrix","title":"Data","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"include(\"../../example_data.jl\")\nuf = example_data(\"UnfoldLinearModel\")\n","category":"page"},{"location":"tutorials/designmatrix/#Plot-Designmatrices","page":"Designmatrix","title":"Plot Designmatrices","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"The following code will result in the default configuration. ","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"plot_designmatrix(designmatrix(uf))","category":"page"},{"location":"tutorials/designmatrix/#kwargs-plot_designmatrix(...;-...).","page":"Designmatrix","title":"kwargs plot_designmatrix(...; ...).","text":"","category":"section"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"sortData (boolean,false) - Indicating whether the data is sorted; using sortslices() of Base Julia. ","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"In order to make the designmatrix easier to read, you may want to sort it.","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"plot_designmatrix(designmatrix(uf); sortData=true)","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"standardizeData (boolean, false) - Indicating whether the data is standardized, mapping the values between 0 and 1. \nxTicks (number, nothing)","category":"page"},{"location":"tutorials/designmatrix/","page":"Designmatrix","title":"Designmatrix","text":"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: xTicks-2 labels are placed between the first and last. - xTicks ≥ number of labels: all labels are placed.","category":"page"},{"location":"how_to/hide_deco/#ht_hide_deco","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"","category":"section"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"This section discusses how users can efficiently hide axis spines and decorations in their plots.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"While it's possible to hide these axis decorations by setting the axis settings with axis=(;...), Makie.Axis provides multiple variables for different aspects of the plot. This means that removing all decorations is only possible by setting many variables each time.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"Makie does provide methods like hidespines! and hidedecorations!, but the user may not have easy access to the axis their plot is drawn in.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"Instead, these functions can be called by setting variables with layout = (;):","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"... layout = (\n ...\n hidespines = (),\n hidedecorations = ()\n)","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"Since these values reflect the input to the function, we can use an empty tuple to remove all decorations and spines, respectively","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"And using hidespines = (:r, :t) will remove the top and right borders.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"For more information on the input of these functions refer to the Makie dokumentation on Axis.","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"Since some plots hide features by default, the hiding can be reverted by setting the variables to nothing","category":"page"},{"location":"how_to/hide_deco/","page":"Hide Axis Spines and Decorations","title":"Hide Axis Spines and Decorations","text":"using TopoPlots\nusing UnfoldMakie\nusing CairoMakie\n\ndata, positions = TopoPlots.example_data()\nplot_topoplot(data[:,340,1]; \n positions = positions, \n layout=(;\n hidespines = nothing,\n hidedecorations = nothing\n ),)","category":"page"},{"location":"#UnfoldMakie-Documentation","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"","category":"section"},{"location":"","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"This is the documentation of the UnfoldMakie module for the Julia programming language. ","category":"page"},{"location":"#About","page":"UnfoldMakie Documentation","title":"About","text":"","category":"section"},{"location":"","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"UnfoldMakie aims to allow users to create different types of visualizations. These include line plots, butterfly plots, design matrices, parallel coordinate plots, ERP images, and topo plots. Building on the Unfold and Makie Modules, it also allows users to customize the plots through an input configuration.","category":"page"},{"location":"","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"As can be seen from the types of visualizations possible, these configuration options try to enable the user to create plots that are helpful in the field of computational EEG. One such example is the ability to use a topo plot as a legend for a line plot by allowing multiple visualizations within a figure.","category":"page"},{"location":"","page":"UnfoldMakie Documentation","title":"UnfoldMakie Documentation","text":"(Image: Coordinated Multiple Views)","category":"page"},{"location":"tutorials/installation/#install_instruct","page":"Installation","title":"Installation","text":"","category":"section"},{"location":"tutorials/installation/#Getting-Julia","page":"Installation","title":"Getting Julia","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"You can install Julia by following the instructions from the official website. ","category":"page"},{"location":"tutorials/installation/#Setup-UnfoldMakie.jl","page":"Installation","title":"Setup UnfoldMakie.jl","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"After installing Julia, you can execute the julia.exe. ","category":"page"},{"location":"tutorials/installation/#Generate-a-Project","page":"Installation","title":"Generate a Project","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"If you do not yet have a project you can generate one. First you type ] into the Julia console to switch from julia to (@VERSION) pkg. Here you can generate a project by using the command: ","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"generate \"FOLDER_PATH\"","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"Note that the specific folder in which you want to generate the project does not already exist.","category":"page"},{"location":"tutorials/installation/#Activate-your-Project","page":"Installation","title":"Activate your Project","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"Before you can add the necessary modules to use UnfoldMakie you have to activate your project in the (@VERSION) pkg environment. The command is: ","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"activate \"FOLDER_PATH\"","category":"page"},{"location":"tutorials/installation/#Install-the-UnfoldMakie-Module","page":"Installation","title":"Install the UnfoldMakie Module","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"When your project is activated you can add the module. The command is: ","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"add UnfoldMakie","category":"page"},{"location":"tutorials/installation/#Using-the-Project-in-a-Notebook","page":"Installation","title":"Using the Project in a Notebook","text":"","category":"section"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"In case you want to use this generated project in a notebook (e.g. Pluto or Jupyter), you can activate this in the notebook in the following manner:","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"begin\n using Pkg\n Pkg.activate(\"FOLDER_PATH\")\n Pkg.resolve()\nend","category":"page"},{"location":"tutorials/installation/","page":"Installation","title":"Installation","text":"Use slash / for the folder path. ","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"EditURL = \"../../../literate/tutorials/circTopo.jl\"","category":"page"},{"location":"generated/tutorials/circTopo/#Circular-Topoplot-Arrangement","page":"Circular TopoPlot","title":"Circular Topoplot Arrangement","text":"","category":"section"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"using UnfoldMakie\nusing CairoMakie\nusing TopoPlots # for example data\nusing Random\nusing DataFrames","category":"page"},{"location":"generated/tutorials/circTopo/#Generate-data","page":"Circular TopoPlot","title":"Generate data","text":"","category":"section"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"Generate a Dataframe. We need to specify the TopoPlot Positions either via position, or via labels (according to TopoPlots.jl)","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"data, pos = TopoPlots.example_data();\ndat = data[:, 240, 1]\ndf = DataFrame(\n :estimate => eachcol(Float64.(data[:, 100:40:300, 1])),\n :circularVariable => [0, 50, 80, 120, 180, 210],\n :time => 100:40:300,\n)\ndf = flatten(df, :estimate);\nnothing #hide","category":"page"},{"location":"generated/tutorials/circTopo/#Our-first-plot!","page":"Circular TopoPlot","title":"Our first plot!","text":"","category":"section"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"note how the plots are at the angles of circularVariable`","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"plot_circulareegtopoplot(\n df;\n positions = pos,\n axis = (; label = \"Sac Incoming\"),\n predictor = :circularVariable,\n)","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"In case the bounding variable is not between 0 and 360, as here we use actually time, we have to specify it. e.g.","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"plot_circulareegtopoplot(\n df;\n positions = pos,\n axis = (; label = \"Time?!\"),\n predictor = :time,\n predictorBounds = [80, 320],\n)","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"","category":"page"},{"location":"generated/tutorials/circTopo/","page":"Circular TopoPlot","title":"Circular TopoPlot","text":"This page was generated using Literate.jl.","category":"page"}] } diff --git a/dev/tutorials/butterfly/index.html b/dev/tutorials/butterfly/index.html index c84957a35..5be5a5be6 100644 --- a/dev/tutorials/butterfly/index.html +++ b/dev/tutorials/butterfly/index.html @@ -4,4 +4,4 @@ using CairoMakie using DataFrames

Note that DataFramesMeta is also used here in order to be able to use @subset for testing (filtering).

Data

We filter the data to make it more clearly represented:

include("../../example_data.jl")
 df, pos = example_data("TopoPlots.jl")
-first(df, 3)
3×7 DataFrame
RowestimatetimechannelcoefnametopoPositionssepval
Float64Float64Int64StringAnyFloat64Float64
10.020321-0.31A(0.493714, 0.544031)0.1228750.266091
20.017548-0.2981A(0.493714, 0.544031)0.1243450.29664
30.0150747-0.2961A(0.493714, 0.544031)0.1248280.323592

Plot Butterfly Plots

The following code will plot the default butterfly plot

plot_butterfly(df)
Example block output

or if you provide the channel positions:

plot_butterfly(df; positions=pos)
Example block output

Column Mappings for Butterfly Plots

Since butterfly plots use a DataFrame as input, the library needs to know the names of the columns used for plotting. You can set these mapping values by calling plot_butterfly(...; mapping=(; :x=:time,)), that is, by specifying a NamedTuple (note the ; right after the opening parentheses).

While there are several default values that will be checked in that order if they exist in the DataFrame, a custom name may need to be chosen:

x

Default is (:x, :time).

y

Default is (:y, :estimate, :yhat).

labels

Default is (:labels, :label, :topoLabels, :sensor, :nothing)

Configurations for Butterfly Plots

Here we look into possible options for configuring the butterfly plot visualization using (...; <name>=<value>, ...). This is the list of unique configuration (key values):

  • topoLegend (boolean)

topoLegend (boolean)

Indicating whether the topo legend is displayed. Default is true.

For more general options look into the Plot Configuration section of the documentation.

Since the configurations for line plots can be applied to butterfly plots as well. Here you can find the configurations for line plots,

+first(df, 3)
3×7 DataFrame
RowestimatetimechannelcoefnametopoPositionssepval
Float64Float64Int64StringAnyFloat64Float64
10.020321-0.31A(0.493714, 0.544031)0.1228750.266091
20.017548-0.2981A(0.493714, 0.544031)0.1243450.29664
30.0150747-0.2961A(0.493714, 0.544031)0.1248280.323592

Plot Butterfly Plots

The following code will plot the default butterfly plot

plot_butterfly(df)
Example block output

or if you provide the channel positions:

plot_butterfly(df; positions=pos)
Example block output

Column Mappings for Butterfly Plots

Since butterfly plots use a DataFrame as input, the library needs to know the names of the columns used for plotting. You can set these mapping values by calling plot_butterfly(...; mapping=(; :x=:time,)), that is, by specifying a NamedTuple (note the ; right after the opening parentheses).

While there are several default values that will be checked in that order if they exist in the DataFrame, a custom name may need to be chosen:

x

Default is (:x, :time).

y

Default is (:y, :estimate, :yhat).

labels

Default is (:labels, :label, :topoLabels, :sensor, :nothing)

Configurations for Butterfly Plots

Here we look into possible options for configuring the butterfly plot visualization using (...; <name>=<value>, ...). This is the list of unique configuration (key values):

  • topoLegend (boolean)

topoLegend (boolean)

Indicating whether the topo legend is displayed. Default is true.

For more general options look into the Plot Configuration section of the documentation.

Since the configurations for line plots can be applied to butterfly plots as well. Here you can find the configurations for line plots,

diff --git a/dev/tutorials/designmatrix/index.html b/dev/tutorials/designmatrix/index.html index e8012297e..fe8e63d0d 100644 --- a/dev/tutorials/designmatrix/index.html +++ b/dev/tutorials/designmatrix/index.html @@ -16,4 +16,4 @@ coeftable(uf) (returns tidy result dataframe) -

Plot Designmatrices

The following code will result in the default configuration.

plot_designmatrix(designmatrix(uf))
Example block output

kwargs plot_designmatrix(...; ...).

  • sortData (boolean,false) - Indicating whether the data is sorted; using sortslices() of Base Julia.

In order to make the designmatrix easier to read, you may want to sort it.

plot_designmatrix(designmatrix(uf); sortData=true)
  • standardizeData (boolean, false) - Indicating whether the data is standardized, mapping the values between 0 and 1.
  • xTicks (number, 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: xTicks-2 labels are placed between the first and last. - xTicks ≥ number of labels: all labels are placed.

+

Plot Designmatrices

The following code will result in the default configuration.

plot_designmatrix(designmatrix(uf))
Example block output

kwargs plot_designmatrix(...; ...).

  • sortData (boolean,false) - Indicating whether the data is sorted; using sortslices() of Base Julia.

In order to make the designmatrix easier to read, you may want to sort it.

plot_designmatrix(designmatrix(uf); sortData=true)
  • standardizeData (boolean, false) - Indicating whether the data is standardized, mapping the values between 0 and 1.
  • xTicks (number, 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: xTicks-2 labels are placed between the first and last. - xTicks ≥ number of labels: all labels are placed.

diff --git a/dev/tutorials/erpimage/index.html b/dev/tutorials/erpimage/index.html index e35a3341e..ebeed727c 100644 --- a/dev/tutorials/erpimage/index.html +++ b/dev/tutorials/erpimage/index.html @@ -7,4 +7,4 @@ plot_erpimage(data)Example block output

Column Mappings for ERP Images

Since ERP images use a Matrix as an input, the library does not need any informations about the mapping.

  • erpBlur (number, 10) - Is a number indicating how much blur is applied to the image; using Gaussian blur of the ImageFiltering module. Negative values deactivate the blur.

  • sortvalues - Indicating whether the data is sorted; using sortperm() of Base Julia

(sortperm() computes a permutation of the array's indices that puts the array into sorted order).

  • meanPlot (bool, false) - Indicating whether the plot should add a line plot below the ERP image, showing the mean of the data. If limits are set in the axis values both plots will be aligned.
plot_erpimage(data;
     meanPlot = true,
     colorbar = (label = "Voltage [µV]",),
-    visual = (colormap = :viridis, colorrange = (-40, 40)))
Example block output + visual = (colormap = :viridis, colorrange = (-40, 40)))Example block output diff --git a/dev/tutorials/installation/index.html b/dev/tutorials/installation/index.html index 67600e4f4..6784340db 100644 --- a/dev/tutorials/installation/index.html +++ b/dev/tutorials/installation/index.html @@ -3,4 +3,4 @@ using Pkg Pkg.activate("FOLDER_PATH") Pkg.resolve() -end

Use slash / for the folder path.

+end

Use slash / for the folder path.

diff --git a/dev/tutorials/parallelcoordinates/index.html b/dev/tutorials/parallelcoordinates/index.html index cf8b091b8..a843bc5cd 100644 --- a/dev/tutorials/parallelcoordinates/index.html +++ b/dev/tutorials/parallelcoordinates/index.html @@ -24,4 +24,4 @@ 25599 │ 0.112385 0.496 64 A (0.719221, 0.888091) 0.262 25600 │ 0.109979 0.498 64 A (0.719221, 0.888091) 0.258 2 columns and 25585 rows omitted, Point{2, Float32}[[0.49371386, 0.5440313], [0.5630452, 0.50400287], [0.5630452, 0.4239459], [0.49371386, 0.38391745], [0.4243825, 0.4239459], [0.4243825, 0.50400287], [0.5378472, 0.6178857], [0.61455333, 0.56901854], [0.6522695, 0.4862579], [0.6388263, 0.39630732] … [0.93907887, 0.6439135], [0.9450873, 0.29968786], [0.8333667, 0.12432156], [0.61803544, 1.9428903f-16], [0.3693923, 2.7755576f-17], [0.15406103, 0.12432156], [0.029739477, 0.3396528], [0.04834886, 0.6439135], [0.26820713, 0.88809085], [0.7192206, 0.88809085]])

Plot PCPs

plot_parallelcoordinates(results_plot, [5,3,2]; # this selects channel 5,3 & 2
-    mapping = (color = :coefname, y = :estimate))
Example block output
Important

the following is still outdated...

Column Mappings for PCPs

Since PCPs use a DataFrame as an input, the library needs to know the names of the columns used for plotting.

While there are multiple default values that are checked in that order if they exist in the DataFrame, a custom name might need to be choosen for:

y

Default is (:y, :estimate, :yhat).

channel

Default is :channel.

color

XXX Default is :coef.

time

Default is :time.

+ mapping = (color = :coefname, y = :estimate))Example block output
Important

the following is still outdated...

Column Mappings for PCPs

Since PCPs use a DataFrame as an input, the library needs to know the names of the columns used for plotting.

While there are multiple default values that are checked in that order if they exist in the DataFrame, a custom name might need to be choosen for:

y

Default is (:y, :estimate, :yhat).

channel

Default is :channel.

color

XXX Default is :coef.

time

Default is :time.

diff --git a/dev/tutorials/topoplot/index.html b/dev/tutorials/topoplot/index.html index 25fb6a783..9c1b75953 100644 --- a/dev/tutorials/topoplot/index.html +++ b/dev/tutorials/topoplot/index.html @@ -7,4 +7,4 @@ df = DataFrame(:estimate => data[:,340,1]) plot_topoplot(df; positions = positions)Example block output

Giving the Positions

Since the topo plot needs the positions of the sensors they have to be put into the drawing function. But there are multiple options (In order of prioritization):

  • Giving the positions directly: plot_topoplot(...; positions=[...])
  • Giving the labels of the sensors: plot_topoplot(...; labels=[...])

To get the positions from the labels we use a database.

Column Mappings for Topo Plots

When using topo plots with a DataFrame as an input, the library needs to know the names of the columns used for plotting. This is specified using the mapping=(;) kwargs.

While there are multiple default values, that are checked in that order if they exist in the DataFrame, a custom name might need to be choosen for:

Note that only one of positions or labels have to be set to draw a topo plot. If both are set, positions takes precedence, labels might be used for labelling electrodes in TopoPlots.jl

(...,mapping=(;))

:y plotting function looks in the default columns of mapping

cfgDefault = UnfoldMakie.PlotConfig()
 cfgDefault.mapping.y
(:estimate, :yhat, :y)

label_text (boolean)

Indicates whether label should drawn next to their position. Obviously the labels have to be provided: plot_topoplot(...; labels=[...])

plot_topoplot(...; visual=(; label_text=true))

label_scatter (boolean)

Indicates whether the dots should be drawn at the given positions.

plot_topoplot(...; visual=(; label_scatter=true))

data, positions = TopoPlots.example_data()
-plot_topoplot(data[1:4,340,1]; visual = (; label_scatter = false), labels=["O1", "F2", "F3", "P4"])
Example block output +plot_topoplot(data[1:4,340,1]; visual = (; label_scatter = false), labels=["O1", "F2", "F3", "P4"])Example block output diff --git a/dev/tutorials/topoplotseries/315bc983-001.png b/dev/tutorials/topoplotseries/315bc983-001.png new file mode 100644 index 000000000..8b956044d Binary files /dev/null and b/dev/tutorials/topoplotseries/315bc983-001.png differ diff --git a/dev/tutorials/topoplotseries/315bc983.png b/dev/tutorials/topoplotseries/315bc983.png new file mode 100644 index 000000000..8b956044d Binary files /dev/null and b/dev/tutorials/topoplotseries/315bc983.png differ diff --git a/dev/tutorials/topoplotseries/8f239f8c-001.png b/dev/tutorials/topoplotseries/8f239f8c-001.png deleted file mode 100644 index c7bc40d5c..000000000 Binary files a/dev/tutorials/topoplotseries/8f239f8c-001.png and /dev/null differ diff --git a/dev/tutorials/topoplotseries/8f239f8c.png b/dev/tutorials/topoplotseries/8f239f8c.png deleted file mode 100644 index c7bc40d5c..000000000 Binary files a/dev/tutorials/topoplotseries/8f239f8c.png and /dev/null differ diff --git a/dev/tutorials/topoplotseries/index.html b/dev/tutorials/topoplotseries/index.html index 28fb80502..f1b4abc00 100644 --- a/dev/tutorials/topoplotseries/index.html +++ b/dev/tutorials/topoplotseries/index.html @@ -5,4 +5,4 @@ using CairoMakie using TopoPlots

Plot Topo Plots Series

Giving the Data

In case you do not already have data, you can get example data from the TopoPlots module. You can do it like this:

data, positions = TopoPlots.example_data()
 df = UnfoldMakie.eeg_matrix_to_dataframe(data[:,:,1], string.(1:length(positions)));
Δbin = 80
-plot_topoplotseries(df, Δbin; positions = positions)
Example block output

With colorbar:

plot_topoplotseries(df, Δbin; positions=positions, layout = (; useColorbar=true))
Example block output

Positions

You can give either positions, or labels. If both are provided, positions have priority

plot_toposeries(...; mapping=(; key=value))

mapping=(: y=(:estimate, :yhat, :y))

visual=(;)

label_text (boolean, false) Indicates whether label should drawn next to their position. The labels have to be given into the function seperately:

Important

currently bugged

label_scatter (boolean, true) - Indicates whether the dots should be drawn at the given positions.

+plot_topoplotseries(df, Δbin; positions = positions)Example block output

With colorbar:

plot_topoplotseries(df, Δbin; positions=positions, layout = (; useColorbar=true))
Example block output

Positions

You can give either positions, or labels. If both are provided, positions have priority

plot_toposeries(...; mapping=(; key=value))

mapping=(: y=(:estimate, :yhat, :y))

visual=(;)

label_text (boolean, false) Indicates whether label should drawn next to their position. The labels have to be given into the function seperately:

Important

currently bugged

label_scatter (boolean, true) - Indicates whether the dots should be drawn at the given positions.