Circular Topoplots
Setup
Package loading
using UnfoldMakie
using CairoMakie
using TopoPlots # for example data
using Random
using DataFrames
Data generation
Generate a Dataframe
. We need to specify the Topoplot positions either via position
, or via labels
.
data, pos = TopoPlots.example_data();
dat = data[:, 240, 1]
df = DataFrame(
:estimate => eachcol(Float64.(data[:, 100:40:300, 1])),
:circular_variable => [0, 50, 80, 120, 180, 210],
:time => 100:40:300,
)
df = flatten(df, :estimate);
Plot generations
Note how the plots are located at the angles of the circular_variable
.
plot_circular_topoplots(
df;
positions = pos,
axis = (; label = "Incoming saccade"),
predictor = :circular_variable,
)

If the bounding variable is not between 0 and 360, since we are using time, we must specify it.
plot_circular_topoplots(
df;
positions = pos,
axis = (; label = "Time?!"),
predictor = :time,
predictor_bounds = [80, 320],
)

Configurations of Circular EEG Plot
UnfoldMakie.plot_circular_topoplots
— Functionplot_circular_topoplots!(f, data::DataFrame; kwargs...)
plot_circular_topoplots(data::DataFrame; kwargs...)
Plot a circular EEG topoplot.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::DataFrame
DataFrame with data keys (columns:y, :yhat, :estimate
), and :position (columns:pos, :position, :positions
).
Keyword argumets (kwargs)
predictor::Vector{Any} = :predictor
The circular predictor value, defines position of topoplot across the circle. Mapped aroundpredictor_bounds
.predictor_bounds::Vector{Int64} = [0, 360]
The bounds of the predictor. Relevant for the axis labels.positions::Vector{Point{2, Float32}} = nothing
Positions of theplot_topoplot
.center_label::String = ""
The text in the center of the cricle.labels::Vector{String} = nothing
Labels for theplot_topoplot
.
Shared plot configuration options
The shared plot options can be used as follows: type = (; key = value, ...))
.
For example, plot_x(...; layout = (; show_legend = true, legend_position = :right))
.
Multiple defaults will be cycled until match.
Placing ;
is important!
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (xlabel = "", aspect = Makie.DataAspect(), label = "") - use kwargs...
of Makie.Axis
layout = (show_legend = false, legend_position = :right, xlabelFromMapping = nothing, ylabelFromMapping = nothing, use_colorbar = true, hidespines = (), hidedecorations = Dict{Symbol, Bool}(:label => 0))
mapping = (x = nothing, y = (:estimate, :yhat, :y), positions = (:pos, :positions, :position, nothing), labels = (:labels, :label, :sensor, nothing))
visual = (colormap = Makie.Reverse{Symbol}(:RdBu), contours = (color = :white, linewidth = 2), label_scatter = true, label_text = true, bounding_geometry = GeometryBasics.Circle) - use kwargs...
of Topoplot.eeg_topoplot
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, flipaxis = true, labelrotation = -1.5707963267948966, label = "Voltage [µV]", colormap = Makie.Reverse{Symbol}(:RdBu)) - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying the Circular topoplot.
This page was generated using Literate.jl.