UnfoldMakie.config_kwargs!Method
config_kwargs!(cfg::PlotConfig; kwargs...)

Takes NamedTuple of Key => NamedTuple as kwargs and merges the fields with the defaults.

source
UnfoldMakie.data_binningMethod
data_binning(df; col_y = :erp, fun = mean, grouping = [])

Group DataFrame according to topoplot coordinates and apply aggregation function.

Arguments:

  • df::AbstractTable
    Requires columns :cont_cuts, col_y (default :erp), and all columns in grouping (col_coord, row_coord, label);
  • col_y = :erp
    The column to combine over (with fun);
  • fun = mean()
    Function to combine.
  • grouping = []
    Vector of symbols or strings, columns to group by the data before aggregation. Values of nothing are ignored.

Return Value: DataFrame.

source
UnfoldMakie.eeg_array_to_dataframeMethod
eeg_array_to_dataframe(data::AbstractMatrix, label_aliases::AbstractVector)
eeg_array_to_dataframe(data::AbstractVector, label_aliases::AbstractVector)
eeg_array_to_dataframe(data::Union{AbstractMatrix, AbstractVector{<:Number}})

Helper function converting an array (Matrix or Vector) to a tidy DataFrame with columns :estimate, :time and :label (with aliases :color, :group, :channel).

Format of Arrays:
- times x condition for plot_erp.
- channels x time for plot_butterfly, plot_topoplotseries.
- channels for plot_topoplot.
Return Value: DataFrame.

source
UnfoldMakie.eeg_topoplot_seriesMethod
 eeg_topoplot_series(data::DataFrame,
    fig,
    data_inp::Union{<:Observable,<:AbstractMatrix};
    layout = nothing,
    xlabels = nothing,
    labels = nothing,
    rasterize_heatmaps = true,
    interactive_scatter = nothing,
    highlight_scatter = false,
    topo_axis = (;),
    topo_attributes = (;),
    positions,
)
eeg_topoplot_series!(fig, data::DataFrame; kwargs..)

Plot a series of topoplots. The function takes the combinefun = mean over the :time column of data.

  • fig
    Figure object.
  • data::Union{<:Observable,<:AbstractMatrix}
    Matrix with size = (nchannel, ntopoplots).
  • layout::Vector{Tuple{Int64, Int64}}
    Vector of tuples with coordinates for each topoplot.
  • xlabels::Vector{String}
    Vector of xlabels for each topoplot.
  • topo_axis::NamedTuple = (;)
    Here you can flexibly change configurations of the topoplot axis.
    To see all options just type ?Axis in REPL.
    Defaults: (aspect = 1, title = "", xgridvisible = false, xminorgridvisible = false, xminorticksvisible = false, xticksvisible = false, xticklabelsvisible = false, xlabelvisible = true, ygridvisible = false, yminorgridvisible = false, yminorticksvisible = false, yticksvisible = false, yticklabelsvisible = false, ylabelvisible = false, leftspinevisible = false, rightspinevisible = false, topspinevisible = false, bottomspinevisible = false, xpanlock = true, ypanlock = true, xzoomlock = true, yzoomlock = true, xrectzoom = false, yrectzoom = false)
  • topo_attributes::NamedTuple = (;)
    Here you can flexibly change configurations of the topoplot interoplation.
    To see all options just type ?Topoplot.topoplot in REPL.
    Defaults: interp_resolution = (128, 128), interpolation = CloughTocher().
  • positions::Vector{Point{2, Float32}}
    Channel positions. The list of x and y positions for all unique electrodes.

Return Value: Tuple{Figure, Vector{Any}}.

source
UnfoldMakie.plot_butterflyMethod
plot_butterfly(plot_data::Union{DataFrame, AbstractMatrix}; kwargs...)
plot_butterfly(times::Vector, plot_data::Union{DataFrame, AbstractMatrix}; kwargs...)
plot_butterfly!(f::Union{GridPosition, GridLayout, Figure}, plot_data::Union{DataFrame, AbstractMatrix}; kwargs...)

Plot a Butterfly plot.

Arguments

  • f::Union{GridPosition, GridLayout, Figure}
    Figure, GridLayout, or GridPosition to draw the plot.
  • data::Union{DataFrame, AbstractMatrix}
    Data for the ERP plot visualization.
  • kwargs...
    Additional styling behavior.
    Often used as: plot_butterfly(df; visual = (; colormap = :romaO)).

Keyword arguments (kwargs)

  • positions::Array = []
    Adds a topoplot as an inset legend to the provided channel positions. Must be the same length as plot_data. To change the colors of the channel lines use the topoposition_to_color function.
  • topolegend::Bool = true
    Show an inlay topoplot with corresponding electrodes. Requires positions.
  • topopositions_to_color::x -> pos_to_color_RomaO(x)
    Change the line colors.
  • topo_axis::NamedTuple = (;)
    Here you can flexibly change configurations of the topoplot axis.
    To see all options just type ?Axis in REPL.
    Defaults: (width = Relative(0.35f0), height = Relative(0.35f0), halign = 0.05, valign = 0.95, aspect = 1)
  • topo_attributes::NamedTuple = (;)
    Here you can flexibly change configurations of the topoplot interoplation.
    To see all options just type ?Topoplot.topoplot in REPL.
    Defaults: (head = (color = :black, linewidth = 1), label_scatter = (markersize = 10, strokewidth = 0.5), interpolation = TopoPlots.NullInterpolator())
  • mapping = (;)
    For highlighting specific channels.
    Example: mapping = (; color = :highlight)), where :highlight is variable with appopriate mapping.

Return Value: Figure displaying Butterfly plot.

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Time", ylabel = "Voltage", yticklabelsize = 14, xtickformat = "{:.1f}") - use kwargs... of Makie.Axis

layout = (show_legend = false, use_colorbar = true, use_legend = true, hidespines = (:r, :t), hidedecorations = Dict{Symbol, Bool}(:label => 0, :ticks => 0, :ticklabels => 0)) - check this page

mapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:channel, :channels, :trial, :trials), positions = (:pos, :positions, :position, :topo_positions, :x, nothing), labels = (:labels, :label, :topoLabels, :sensor, nothing), group = (:channel,)) - use any mapping from AlgebraOfGraphics

visual = (colormap = nothing, color = nothing) - use kwargs... of Makie.lines

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center, framevisible = false) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, label = "", flipaxis = true) - use kwargs... of AlgebraOfGraphics.colorbar!

see also plot_erp

source
UnfoldMakie.plot_channelimageMethod
plot_channelimage!(f::Union{GridPosition, GridLayout, Figure}, data::Union{DataFrame,AbstractMatrix}, positions::Vector{Point{2,Float32}}, ch_names::Vector{String}; kwargs...)
plot_channelimage(data::Union{DataFrame, AbstractMatrix}, positions::Vector{Point{2,Float32}}, ch_names::Vector{String}; kwargs...)

Plot a Channel image

Arguments

  • f::Union{GridPosition, GridLayout, Figure}
    Figure, GridLayout, or GridPosition to draw the plot.
  • data::Union{DataFrame, AbstractMatrix}
    DataFrame or Matrix with data.
    Data should has a format of 1 row - 1 channel.
  • positions::Vector{Point{2,Float32}}
    A vector with EEG layout coordinates.
  • ch_names::Vector{String}
    Vector with channel names.
  • times::Vector = range(-0.3, 1.2, length = size(data, 2))
    Time range on x-axis.
  • sorting_variables::Vector = [:y, :x]
    Method to sort channels on y-axis.
    For instance, you can sort by channel positions on the scalp (x, y) or channel name.
  • sorting_reverse::Vector = [:false, :false]
    Should sorting variables be reversed or not?

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Time", ylabel = "Channels", yticklabelsize = 14) - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true) - check this page

mapping = (x = (:time,), y = (:estimate, :yhat, :y)) - use any mapping from AlgebraOfGraphics

visual = (colormap = Makie.Reverse{String}("RdBu"),) - use kwargs... of Makie.heatmap

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, label = "Voltage") - use kwargs... of Makie.Colorbar

Return Value: Figure displaying the Channel image.

source
UnfoldMakie.plot_circular_topoplotsMethod
plot_circular_topoplots!(f, data::DataFrame; kwargs...)
plot_circular_topoplots(data::DataFrame; kwargs...)

Plot a circular EEG topoplot.

Arguments

  • f::Union{GridPosition, GridLayout, Figure}
    Figure, GridLayout, or GridPosition to draw the plot.
  • data::DataFrame
    DataFrame with data keys (columns :y, :yhat, :estimate), and :position (columns :pos, :position, :positions).

Keyword arguments (kwargs)

  • predictor::Vector{Any} = :predictor
    The circular predictor value, defines position of topoplot across the circle. Mapped around predictor_bounds.
  • predictor_bounds::Vector{Int64} = [0, 360]
    The bounds of the predictor. Relevant for the axis labels.
  • positions::Vector{Point{2, Float32}} = nothing
    Positions of the plot_topoplot.
  • center_label::String = ""
    The text in the center of the cricle.
  • plot_radius::String = 0.8
    The radius of the circular topoplot series plot calucalted by formula: radius = (minwidth * plot_radius) / 2.
  • labels::Vector{String} = nothing
    Labels for the plot_topoplots.

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Time", aspect = Makie.DataAspect(), label = "") - use kwargs... of Makie.Axis

layout = (show_legend = false, use_colorbar = true, hidespines = (), hidedecorations = Dict{Symbol, Bool}(:label => 0)) - check this page

mapping = (x = nothing, y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing)) - use any mapping from AlgebraOfGraphics

visual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), enlarge = 1, label_scatter = true, label_text = false, bounding_geometry = GeometryBasics.Circle) - use kwargs... of Topoplot.eeg_topoplot

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, flipaxis = true, label = "Voltage", colormap = Makie.Reverse{Symbol}(:RdBu)) - use kwargs... of Makie.Colorbar

Return Value: Figure displaying the Circular topoplot series.

source
UnfoldMakie.plot_designmatrixMethod
plot_designmatrix!(f::Union{GridPosition, GridLayout, Figure}, data::Unfold.DesignMatrix; kwargs...)
plot_designmatrix(data::Unfold.DesignMatrix; kwargs...)

Plot a designmatrix.

Arguments

  • f::Union{GridPosition, GridLayout, Figure}
    Figure, GridLayout, or GridPosition to draw the plot.
  • data::Unfold.DesignMatrix
    Data for the plot visualization.

Keyword arguments (kwargs)

  • standardize_data::Bool = true
    Indicates whether the data is standardized by pointwise division of the data with its sampled standard deviation.
  • sort_data::Bool = true
    Indicates whether the data is sorted. It uses sortslices() of Base Julia.
  • xticks::Num = nothing
    Returns the number of labels on the x axis.
    • xticks = 0: no labels are placed.
    • xticks = 1: first possible label is placed.
    • xticks = 2: first and last possible labels are placed.
    • 2 < xticks < number of labels: equally distribute the labels.
    • xticksnumber 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(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Conditions", ylabel = "Trials", xticklabelrotation = 0.39) - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true) - check this page

mapping = (x = (:time,), y = (:estimate, :yhat, :y)) - use any mapping from AlgebraOfGraphics

visual = (colormap = :roma,) - use kwargs... of Makie.heatmap

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, flipaxis = true, label = "") - use kwargs... of Makie.Colorbar

Return Value: Figure displaying the Design matrix.

source
UnfoldMakie.plot_erpMethod
plot_erp!(f::Union{GridPosition, GridLayout, Figure}, plot_data::Union{DataFrame, AbstractMatrix, AbstractVector{<:Number}}; kwargs...)
plot_erp(times, plot_data::Union{DataFrame, AbstractMatrix, AbstractVector{<:Number}}; kwargs...)

Plot an ERP plot.

Arguments

  • f::Union{GridPosition, GridLayout, Figure}
    Figure, GridLayout, or GridPosition to draw the plot.
  • data::Union{Union{DataFrame, AbstractMatrix, AbstractVector{<:Number}, Vector{Float32}}
    Data for the ERP plot visualization.
  • kwargs...
    Additional styling behavior.
    Often used as: plot_erp(df; mapping = (; color = :coefname, col = :conditionA)).

Keyword arguments (kwargs)

  • stderror::Bool = false
    Add an error ribbon, with lower and upper limits based on the :stderror column.
  • significance::DataFrame = nothing
    Show significant time periods as horizontal bars.
    Example: DataFrame(from = [0.1, 0.3], to = [0.5, 0.7], coefname = ["(Intercept)", "condition: face"]).
    If coefname is not specified, the significance lines will be black.
  • layout.use_colorbar = true
    Enable or disable colorbar.
  • layout.use_legend = true
    Enable or disable legend.
  • layout.show_legend = true
    Enable or disable legend and colorbar.
  • mapping = (;)
    Specify color, col (column), linestyle, group.
    F.i. mapping = (; col = :group) will make a column for each group.
  • visual = (; color = Makie.wong_colors, colormap = :roma)
    For categorical color use visual.color, for continuous - visual.colormap.

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Time", ylabel = "Voltage", yticklabelsize = 14, xtickformat = "{:.1f}") - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true, use_legend = true, hidespines = (:r, :t), hidedecorations = Dict{Symbol, Bool}(:grid => 1, :label => 0, :ticks => 0, :ticklabels => 0)) - check this page

mapping = (x = (:time,), y = (:estimate, :yhat, :y), color = (:color, :coefname, nothing)) - use any mapping from AlgebraOfGraphics

visual = (colormap = :roma, color = ColorTypes.RGBA{Float32}[RGBA{Float32}(0.0f0,0.44705883f0,0.69803923f0,1.0f0), RGBA{Float32}(0.9019608f0,0.62352943f0,0.0f0,1.0f0), RGBA{Float32}(0.0f0,0.61960787f0,0.4509804f0,1.0f0), RGBA{Float32}(0.8f0,0.4745098f0,0.654902f0,1.0f0), RGBA{Float32}(0.3372549f0,0.7058824f0,0.9137255f0,1.0f0), RGBA{Float32}(0.8352941f0,0.36862746f0,0.0f0,1.0f0), RGBA{Float32}(0.9411765f0,0.89411765f0,0.25882354f0,1.0f0)]) - use kwargs... of Makie.lines

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center, framevisible = false) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, label = "", flipaxis = true) - use kwargs... of AlgebraOfGraphics.colorbar!

Return Value: Figure displaying the ERP plot.

source
UnfoldMakie.plot_erpgridMethod
plot_erpgrid(data::Union{Matrix{<:Real}, DataFrame}, positions::Vector; kwargs...)
plot_erpgrid!(f::Union{GridPosition, GridLayout, Figure}, data::Union{Matrix{<:Real}, DataFrame}, positions::Vector, ch_names::Vector{String}; kwargs...)

Plot an ERP image.

Arguments

  • f::Union{GridPosition, GridLayout, Figure}
    Figure, GridLayout, or GridPosition to draw the plot.
  • data::Union{Matrix{<:Real}, DataFrame}
    Data for the plot visualization.
    Data should has a format of 1 row - 1 channel.
  • positions::Vector{Point{2,Float}}
    Electrode positions.
  • ch_names::Vector{String}
    Vector with channel names.
  • hlines_grid_axis::NamedTuple = (;)
    Here you can flexibly change configurations of the hlines on all subaxes.
    To see all options just type ?hlines in REPL.
    Defaults: (color = :gray, linewidth = 0.5)
  • vlines_grid_axis::NamedTuple = (;)
    Here you can flexibly change configurations of the vlines on all subaxes.
    To see all options just type ?vlines in REPL.
    Defaults: (color = :gray, linewidth = 0.5, ymin = 0.2, ymax = 0.8)
  • lines_grid_axis::NamedTuple = (;)
    Here you can flexibly change configurations of the lines on all subaxes.
    To see all options just type ?lines in REPL.
    Defaults: (color = :deepskyblue3,)
  • labels_grid_axis::NamedTuple = (;)
    Here you can flexibly change configurations of the labels on all subaxes.
    To see all options just type ?text in REPL.
    Defaults: (color = :gray, fontsize = 12, align = (:left, :top), space = :relative)

Keyword arguments (kwargs)

  • drawlabels::Bool = false
    Draw channels labels over each waveform.
  • times::Vector = 1:size(data, 2)
    Vector of size().

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Time", ylabel = "Voltage", xlim = [-0.04, 1.0], ylim = [-0.04, 1.0], fontsize = 12) - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true) - check this page

mapping = (x = (:time,), y = (:estimate, :yhat, :y)) - use any mapping from AlgebraOfGraphics

visual = (colormap = :roma,) - use kwargs... of Makie.lines

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966) - use kwargs... of Makie.Colorbar

Return Value: Figure displaying ERP grid.

source
UnfoldMakie.plot_erpimageMethod
plot_erpimage!(f::Union{GridPosition, GridLayout, Figure}, data::AbstractMatrix{Float64}; kwargs...)
plot_erpimage!(f::Union{GridPosition, GridLayout, Figure}, data::Observable{<:AbstractMatrix}; kwargs...)
plot_erpimage!(f::Union{GridPosition, GridLayout, Figure}, times::Observable{<:AbstractVector}, data::Observable{<:AbstractMatrix{<:Real}}; kwargs...)

plot_erpimage(times::AbstractVector, data::Union{<:Observable{Matrix{<:Real}}, Matrix{<:Real}}; kwargs...)
plot_erpimage(data::Matrix{Float64}; kwargs...)

Plot an ERP image.

Arguments:

  • f::Union{GridPosition, GridLayout, Figure}
    Figure, GridLayout, or GridPosition to draw the plot.
  • data::Union{DataFrame, Vector{Float32}}
    Data for the plot visualization.

Keyword arguments (kwargs)

  • erpblur::Number = 10
    Number indicating how much blur is applied to the image.
    Gaussian blur of the ImageFiltering module is used.
    Non-Positive values deactivate the blur.
  • sortvalues::Vector{Int64} = false
    Parameter over which plot will be sorted. Using sortperm() of Base Julia.
    sortperm() computes a permutation of the array's indices that puts the array in sorted order.
  • sortindex::Vector{Int64} = nothing
    Sorting over index values.
  • meanplot::bool = false
    Add a line plot below the ERP image, showing the mean of the data.
  • show_sortval::bool = false
    Add a plot on the right from ERP image, showing the distribution of the sorting data.
  • sortval_xlabel::String = "Sorting variable"
    If show_sortval = true controls xlabel.
  • axis.ylabel::String = "Trials"
    If sortvalues = true the default text will change to "Sorted trials", but it could be changed to any values specified manually.
  • meanplot_axis::NamedTuple = (;)
    Here you can flexibly change configurations of meanplot.
    To see all options just type ?Axis in REPL.
    Defaults: (height = 100, xlabel = "Time", xlabelpadding = 0, xautolimitmargin = (0, 0))
  • sortplot_axis::NamedTuple = (;)
    Here you can flexibly change configurations of meanplot.
    To see all options just type ?Axis in REPL.
    Defaults: (ylabelvisible = true, yticklabelsvisible = false)

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Time", ylabel = "Trials") - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true) - check this page

mapping = (x = (:time,), y = (:estimate, :yhat, :y)) - use any mapping from AlgebraOfGraphics

visual = (colormap = Makie.Reverse{String}("RdBu"),) - use kwargs... of Makie.heatmap

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, label = "Voltage") - use kwargs... of Makie.Colorbar

Return Value: Figure displaying the ERP image.

source
UnfoldMakie.plot_parallelcoordinatesMethod
plot_parallelcoordinates(data::Union{DataFrame, AbstractMatrix}; kwargs...)
plot_parallelcoordinates!(f::Union{GridPosition, GridLayout, Figure}, data::Union{DataFrame, AbstractMatrix}; kwargs)

Plot a PCP (parallel coordinates plot).
Dimensions: conditions, channels, time, trials.

Arguments:

  • f::Union{GridPosition, GridLayout, Figure} Figure, GridLayout, or GridPosition to draw the plot.
  • data::Union{DataFrame, AbstractMatrix}
    Data for the plot visualization.

Keyword arguments (kwargs)

  • normalize::Symbol = nothing
    If :minmax, normalize each axis to their respective min-max range.
  • ax_labels::Vector{String} = nothing
    Specify axis labels.
    Should be a vector of labels with length equal to the number of unique mapping.x values.
    Example: ax_labels = ["Fz", "Cz", "O1", "O2"].
  • ax_ticklabels::Symbol = :outmost
    Specify tick labels on axis.
    • :all - show all labels on all axes.
    • :left - show all labels on the left axis, but only min and max on others.
    • :outmost - show labels on min and max of all other axes.
    • :none - remove all labels.
  • bend::Bool = false
    Change straight lines between the axes to curved ("bent") lines using spline interpolation.
    Note: While this makes the plot look cool, it is not generally recommended to bent the lines, as interpretation suffers, and the resulting visualizations can be potentially missleading.
  • visual.alpha::Number = 0.5
    Change of line transparency.

Defining the axes

  • mapping.x = :channel, mapping.y = :estimate.
    Overwrite what should be on the x and the y axes.
  • mapping.color = :colorcolumn
    Split conditions by color. The default color is :black.

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Channels", ylabel = "Time", title = "") - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true) - check this page

mapping = (x = :channel, y = (:estimate, :yhat, :y)) - use any mapping from AlgebraOfGraphics

visual = (colormap = ColorTypes.RGBA{Float32}[RGBA{Float32}(0.0f0,0.44705883f0,0.69803923f0,1.0f0), RGBA{Float32}(0.9019608f0,0.62352943f0,0.0f0,1.0f0), RGBA{Float32}(0.0f0,0.61960787f0,0.4509804f0,1.0f0), RGBA{Float32}(0.8f0,0.4745098f0,0.654902f0,1.0f0), RGBA{Float32}(0.3372549f0,0.7058824f0,0.9137255f0,1.0f0), RGBA{Float32}(0.8352941f0,0.36862746f0,0.0f0,1.0f0), RGBA{Float32}(0.9411765f0,0.89411765f0,0.25882354f0,1.0f0)], color = :black, alpha = 0.3) - use kwargs... of Makie.lines

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center, title = "Conditions", merge = true, framevisible = false) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966) - use kwargs... of Makie.Colorbar

Return Value: Figure displaying the Parallel coordinates plot.

source
UnfoldMakie.plot_splinesMethod
plot_splines(m::UnfoldModel; kwargs...)
plot_splines!(f::Union{GridPosition, GridLayout, Figure}, m::UnfoldModel; kwargs...)

Visualization of spline terms in an UnfoldModel. Two subplots are generated for each spline term:
1) the basis function of the spline; 2) the density of the underlying covariate.
Multiple spline terms are arranged across columns.
Dashed lines indicate spline knots.

Arguments:

  • f::Union{GridPosition, GridLayout, Figure} Figure, GridLayout, or GridPosition to draw the plot.
  • m::UnfoldModel
    UnfoldModel with splines.
  • spline_axis::NamedTuple = (;)
    Here you can flexibly change configurations of spline subplots.
    To see all options just type ?Axis in REPL.
    Defaults: (ylabel = "Spline value", xlabelvisible = false, xticklabelsvisible = false, ylabelvisible = true)
  • density_axis::NamedTuple = (;)
    Here you can flexibly change configurations of density subplots.
    To see all options just type ?Axis in REPL.
    Defaults: (xautolimitmargin = (0, 0), ylabel = "Density value")
  • superlabel_config::NamedTuple = (;)
    Here you can flexibly change configurations of the Label on the top of the plot.
    To see all options just type ?Label in REPL.
    Defaults: (fontsize = 20, padding = (0, 0, 40, 0))

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = NamedTuple() - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true) - check this page

mapping = (x = (:time,), y = (:estimate, :yhat, :y)) - use any mapping from AlgebraOfGraphics

visual = (colormap = :viridis,) - use kwargs... of Makie.series

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center, title = "Splines", framevisible = false) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966) - use kwargs... of Makie.Colorbar

Return Value: Figure with splines and their density for basis functions.

source
UnfoldMakie.plot_topoplotMethod
plot_topoplot!(f::Union{GridPosition, GridLayout, Figure}, data::Union{<:Observable{<:DataFrame},<:AbstractDataFrame,<:AbstractVector}; positions::Vector, labels = nothing, kwargs...)

using Interpolations: positions plot_topoplot(data::Union{<:Observable{<:DataFrame},<:AbstractDataFrame,<:AbstractVector}; position::Vector, labels = nothing, kwargs...)

Plot a topoplot.

Arguments

  • f::Union{GridPosition, GridLayout, Figure}
    Figure, GridLayout, or GridPosition to draw the plot.
  • data::Union{<:Observable{<:DataFrame},<:AbstractDataFrame,<:AbstractVector}
    Data for the plot visualization.
  • positions::Vector{Point{2, Float32}}
    Positions used if data is not a DataFrame. Positions are generated from labels if positions = nothing.
  • labels::Vector{String} = nothing
    Labels used if data is not a DataFrame.
  • high_chan = nothing - channnel(s) to highlight by color.
  • high_color = :darkgreen - color for highlighting.
  • topo_axis::NamedTuple = (;)
    Here you can flexibly change configurations of the topoplot axis.
    To see all options just type ?Axis in REPL.
    Defaults: (width = Relative(1.0f0), height = Relative(1.0f0), halign = 0.05, valign = 0.95, aspect = DataAspect())
  • topo_attributes::NamedTuple = (;)
    Here you can flexibly change configurations of the topoplot interoplation.
    To see all options just type ?Topoplot.topoplot in REPL.
    Defaults: interp_resolution = (128, 128), interpolation = CloughTocher()

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Time", aspect = Makie.DataAspect()) - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true, hidespines = (), hidedecorations = Dict{Symbol, Bool}(:label => 0)) - check this page

mapping = (x = nothing, y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing)) - use any mapping from AlgebraOfGraphics

visual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), enlarge = 1, label_scatter = true, label_text = false, bounding_geometry = GeometryBasics.Circle) - use kwargs... of Topoplot.eeg_topoplot

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, flipaxis = true, label = "Voltage") - use kwargs... of Makie.Colorbar

Return Value: Figure displaying the Topoplot.

source
UnfoldMakie.plot_topoplotseriesMethod
plot_topoplotseries(f::Union{GridPosition, GridLayout, Figure}, data::Union{<:Observable{<:DataFrame},DataFrame}; kwargs...)
plot_topoplotseries!(data::Union{<:Observable{<:DataFrame},DataFrame}; kwargs...)

Multiple miniature topoplots in regular distances.

Arguments

  • f::Union{GridPosition, GridLayout, GridLayoutBase.GridSubposition, Figure}
    Figure, GridLayout, GridPosition, or GridLayoutBase.GridSubposition to draw the plot.
  • data::Union{<:Observable{<:DataFrame},DataFrame}
    DataFrame with data or Observable DataFrame.
    Requires a time column by default, but can be overridden by specifying mapping=(; x=:my_column) with any continuous or categorical column.

Keyword arguments (kwargs)

  • bin_width::Real = nothing
    Number specifing the width of bin of continuous x-value in its units.
  • bin_num::Real = nothing
    Number of topoplots.
    Either bin_width, or bin_num should be specified. Error if they are both specified
    If mapping.col or mapping.row are categorical bin_width and bin_num stay as nothing.
  • combinefun::Function = mean
    Specify how the samples within bin_width are summarised.
    Example functions: mean, median, std.
  • rasterize_heatmaps::Bool = true
    Force rasterization of the plot heatmap when saving in svg format.
    Except for the interpolated heatmap, all lines/points are vectors.
    This is typically what you want, otherwise you get ~128x128 vectors per topoplot, which makes everything very slow.
  • col_labels::Bool, row_labels::Bool = true
    Shows column and row labels for categorical values.
  • positions::Vector{Point{2, Float32}} = nothing
    Specify channel positions. Requires the list of x and y positions for all unique electrodes.
  • labels::Vector{String} = nothing
    Show labels for each electrode.
  • interactive_scatter = nothing
    Enable interactive mode.
    If you create obs_tuple = Observable((0, 0, 0)) and pass it into interactive_scatter you can update the observable tuple with the indices of the clicked topoplot markers.
    (0, 0, 0) corresponds to the (row of topoplot layout, column of topoplot layout, electrode).
  • topo_axis::NamedTuple = (;)
    Here you can flexibly change configurations of topoplots.
    To see all options just type ?Axis in REPL.
  • mapping = (; col = :time, row = nothing, layout = nothing)
    mapping.col - specify x-value, can be any continuous or categorical variable.
    mapping.row - specify y-value, can be any continuous or categorical variable (not implemented yet).
    mapping.layout - arranges topoplots by rows when equals :time.
  • visual.colorrange::2-element Vector{Int64}
    Resposnible for colorrange in topoplots and in colorbar.
  • topo_attributes::NamedTuple = (;)
    Here you can flexibly change configurations of the topoplot interoplation.
    To see all options just type ?Topoplot.topoplot in REPL.
    Defaults: interp_resolution = (128, 128), interpolation = CloughTocher()

Shared plot configuration options

The shared plot options can be used as follows: type = (; key = value, ...)).
For example, plot_x(...; colorbar = (; vertical = true, label = "Test")).
Multiple defaults will be cycled until match.

Placing ; is important!

figure = NamedTuple() - use kwargs... of Makie.Figure

axis = (xlabel = "Time windows", aspect = Makie.DataAspect(), title = "", titlesize = 16, titlefont = :bold, ylabel = "", ylabelpadding = 25, xlabelpadding = 25, xpanlock = true, ypanlock = true, xzoomlock = true, yzoomlock = true, xrectzoom = false, yrectzoom = false) - use kwargs... of Makie.Axis

layout = (show_legend = true, use_colorbar = true, hidespines = (), hidedecorations = Dict{Symbol, Bool}(:label => 0)) - check this page

mapping = (x = nothing, y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing), col = (:time,), row = (nothing,)) - use any mapping from AlgebraOfGraphics

visual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), enlarge = 1, label_scatter = false, label_text = false, bounding_geometry = GeometryBasics.Circle, levels = nothing) - use kwargs... of Topoplot.eeg_topoplot

legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs... of Makie.Legend

colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, flipaxis = true, label = "Voltage", colorrange = nothing) - use kwargs... of Makie.Colorbar

Return Value: Figure displaying the Topoplot series.

source
UnfoldMakie.rel_to_abs_bboxMethod
rel_to_abs_bbox(org, rel)

Takes a rectangle org consiting of coordinates of origins and applies the relative transformation tuple rel.

Return Value: Makie.BBox.

source
UnfoldMakie.supportive_defaultsMethod
supportive_defaults(cfg_symb::Symbol)

Default configurations for the supporting axis. Similar to PlotConfig, but these configurations are not shared by all plots.
Such supporting axes allow users to flexibly see defaults in docstrings and manipulate them using corresponding axes.

For developers: to make them updateable in the function, use update_axis. Return value: NamedTuple.

source
UnfoldMakie.to_positionsMethod
to_positions(x, y, z; sphere = [0, 0, 0.])
to_positions(pos::AbstractMatrix; sphere = [0, 0, 0.])

Projects 3D electrode positions to a 2D layout. Reimplementation of the MNE algorithm.

Assumes size(pos) = (3, nChannels) when input is AbstractMatrix.

Tip: You can get positions directly from an MNE object after loading PyMNE and enabling the UnfoldMakie PyMNE extension.

Return Value: Vector{Point2{Float64}}.

source
UnfoldMakie.update_axisMethod
update_axis(support_axis::NamedTuple; kwargs...)

Update values of NamedTuple{key = value}.
Used for supportive axes to make users be able to flexibly change them.

source

Internally, we use a PlotConfig struct to keep track of common plotting options, so that all functions have a similar API.