Plotting Functions
All public plotting functions in EegFun.jl.
Index
EegFun.plot_artifact_componentsEegFun.plot_artifact_detectionEegFun.plot_artifact_rejectionEegFun.plot_artifact_repairEegFun.plot_channel_summaryEegFun.plot_channel_summary!EegFun.plot_confusion_matrixEegFun.plot_correlation_heatmapEegFun.plot_correlation_heatmap!EegFun.plot_databrowserEegFun.plot_databrowserEegFun.plot_databrowserEegFun.plot_decodingEegFun.plot_ecg_component_featuresEegFun.plot_eog_component_featuresEegFun.plot_epochsEegFun.plot_erpEegFun.plot_erp!EegFun.plot_erp_imageEegFun.plot_erp_measurementsEegFun.plot_erp_statsEegFun.plot_filter_responseEegFun.plot_frequency_spectrumEegFun.plot_gfpEegFun.plot_guiEegFun.plot_ica_component_activationEegFun.plot_joint_probabilityEegFun.plot_joint_probability!EegFun.plot_layout_2dEegFun.plot_layout_2d!EegFun.plot_layout_3dEegFun.plot_layout_3d!EegFun.plot_line_noise_componentsEegFun.plot_model_correlationsEegFun.plot_rdm_heatmapEegFun.plot_rdm_timecourseEegFun.plot_rsaEegFun.plot_spatial_kurtosis_componentsEegFun.plot_tfEegFun.plot_tf_statsEegFun.plot_topographyEegFun.plot_topographyEegFun.plot_topographyEegFun.plot_topographyEegFun.plot_topographyEegFun.plot_topographyEegFun.plot_topographyEegFun.plot_topographyEegFun.plot_topography!EegFun.plot_topography!EegFun.plot_topography_statsEegFun.plot_topography_statsEegFun.plot_trigger_overviewEegFun.plot_trigger_timing
Functions
EegFun.plot_artifact_components Method
plot_artifact_components(ica::InfoIca, artifacts::ArtifactComponents; kwargs...)Plot topoplots for all artifact components organized by type (vEOG, hEOG, ECG, Line Noise, Channel Noise).
This is a convenience function that takes the output of combine_artifact_components and creates a comprehensive visualization showing all identified artifact components with clear labels.
Arguments
ica::InfoIca: The ICA result objectartifacts::ArtifactComponents: The artifact components structure fromcombine_artifact_components
Keyword Arguments
All keyword arguments from plot_topography are supported, including:
method::Symbol: Interpolation method (seeplot_topographyfor supported methods)gridscale::Int: Grid resolution for interpolationcolormap: Colormap for the topographydisplay_plot::Bool: Whether to display the plot
Returns
Figure: The Makie Figure containing all topoplots
Examples
# Identify artifact components
eog_comps, _ = identify_eog_components(dat, ica)
ecg_comps, _ = identify_ecg_components(dat, ica)
line_noise_comps, _ = identify_line_noise_components(dat, ica)
channel_noise_comps, _ = identify_spatial_kurtosis_components(ica)
# Combine them
artifacts = combine_artifact_components(eog_comps, ecg_comps, line_noise_comps, channel_noise_comps)
# Plot all artifact components
fig = plot_artifact_components(ica, artifacts)EegFun.plot_artifact_detection Method
plot_artifact_detection(epochs::EpochData, artifacts::EpochRejectionInfo; channel_selection::Function=channels(), kwargs...)Interactive plot of artifact detection results with Previous/Next buttons for epoch navigation.
Arguments
epochs::EpochData: The epoch dataartifacts::EpochRejectionInfo: Artifact detection resultschannel_selection::Function: Channel predicate for selecting channels to plot (default: all layout channels)
Keyword Arguments
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
display_plot::Bool=true: Display plot.ygrid::Bool=false: Whether to show y-axis gridxlim::Nothing=nothing: X-axis limits as (min, max) tuple or nothing for auto-scalingyminorgrid::Bool=false: Whether to show y-axis minor gridylim::Nothing=nothing: Y-axis limits as (min, max) tuple or nothing for auto-scalingalpha_normal::Float64=0.2: Transparency for normal channels.colormap_name::Symbol=jet: Colormap name (e.g., :Set1_9, :tab20).xminorgrid::Bool=false: Whether to show x-axis minor gridlinewidth_rejected::Int64=2: Line width for rejected channels.alpha_rejected::Float64=1.0: Transparency for rejected channels.selection_threshold::Int64=50: Distance threshold for channel selection.xgrid::Bool=false: Whether to show x-axis gridlinewidth_normal::Int64=1: Line width for normal channels.add_xy_origin::Bool=true: Whether to add origin lines at x=0 and y=0
Returns
Figure: Interactive Makie figure with navigation buttons
Examples
# Basic interactive plot
fig = plot_artifact_detection(epochs, artifacts)
# With specific channels
fig = plot_artifact_detection(epochs, artifacts,
channel_selection = channels([:Fp1, :Fp2, :Cz]))
# With custom axis limits
fig = plot_artifact_detection(epochs, artifacts, xlim = (-0.2, 0.8), ylim = (-100, 100))EegFun.plot_artifact_rejection Method
plot_artifact_rejection(epochs_original::EpochData, epochs_rejected::EpochData, artifacts::EpochRejectionInfo; channel_selection::Function=channels(), kwargs...)Interactive plot comparison between original and rejected epochs with navigation buttons. Epochs are aligned by epoch number from the dataframe. If an epoch was rejected (doesn't exist in epochs_rejected), both plots show a blank plot with red spines.
Arguments
epochs_original::EpochData: Original epoch data (before rejection)epochs_rejected::EpochData: Epoch data after rejection (may have fewer epochs)artifacts::EpochRejectionInfo: Artifact detection resultschannel_selection::Function: Channel predicate for selecting channels to plot (default: all layout channels)
Keyword Arguments
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
display_plot::Bool=true: Display plot.ygrid::Bool=false: Whether to show y-axis gridxlim::Nothing=nothing: X-axis limits as (min, max) tuple or nothing for auto-scalingyminorgrid::Bool=false: Whether to show y-axis minor gridylim::Nothing=nothing: Y-axis limits as (min, max) tuple or nothing for auto-scalingalpha_normal::Float64=0.2: Transparency for normal channels.colormap_name::Symbol=jet: Colormap name (e.g., :Set1_9, :tab20).xminorgrid::Bool=false: Whether to show x-axis minor gridlinewidth_rejected::Int64=2: Line width for rejected channels.alpha_rejected::Float64=1.0: Transparency for rejected channels.selection_threshold::Int64=50: Distance threshold for channel selection.xgrid::Bool=false: Whether to show x-axis gridlinewidth_normal::Int64=1: Line width for normal channels.add_xy_origin::Bool=true: Whether to add origin lines at x=0 and y=0
Returns
Figure: Interactive Makie figure with navigation buttons showing before/after comparison
Examples
# Basic interactive rejection comparison
fig = plot_artifact_rejection(epochs_orig, epochs_rejected, artifacts)
# With specific channels
fig = plot_artifact_rejection(epochs_orig, epochs_rejected, artifacts,
channel_selection = channels([:Fp1, :Fp2, :Cz]))
# With custom axis limits
fig = plot_artifact_rejection(epochs_orig, epochs_rejected, artifacts, xlim = (-0.2, 0.8), ylim = (-100, 100))EegFun.plot_artifact_repair Method
plot_artifact_repair(epochs_original::EpochData, epochs_repaired::EpochData, artifacts::EpochRejectionInfo; channel_selection::Function=channels(), kwargs...)Interactive plot comparison between original and repaired epochs with navigation buttons.
Arguments
epochs_original::EpochData: Original epoch dataepochs_repaired::EpochData: Repaired epoch dataartifacts::EpochRejectionInfo: Artifact detection resultschannel_selection::Function: Channel predicate for selecting channels to plot (default: all layout channels)
Keyword Arguments
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
display_plot::Bool=true: Display plot.ygrid::Bool=false: Whether to show y-axis gridxlim::Nothing=nothing: X-axis limits as (min, max) tuple or nothing for auto-scalingyminorgrid::Bool=false: Whether to show y-axis minor gridylim::Nothing=nothing: Y-axis limits as (min, max) tuple or nothing for auto-scalingalpha_normal::Float64=0.2: Transparency for normal channels.colormap_name::Symbol=jet: Colormap name (e.g., :Set1_9, :tab20).xminorgrid::Bool=false: Whether to show x-axis minor gridlinewidth_rejected::Int64=2: Line width for rejected channels.alpha_rejected::Float64=1.0: Transparency for rejected channels.selection_threshold::Int64=50: Distance threshold for channel selection.xgrid::Bool=false: Whether to show x-axis gridlinewidth_normal::Int64=1: Line width for normal channels.add_xy_origin::Bool=true: Whether to add origin lines at x=0 and y=0
Returns
Figure: Interactive Makie figure with navigation buttons showing before/after comparison
Examples
# Basic interactive repair comparison
fig = plot_artifact_repair(epochs_orig, epochs_repaired, artifacts)
# With specific channels
fig = plot_artifact_repair(epochs_orig, epochs_repaired, artifacts,
channel_selection = channels([:Fp1, :Fp2, :Cz]))
# With custom axis limits
fig = plot_artifact_repair(epochs_orig, epochs_repaired, artifacts, xlim = (-0.2, 0.8), ylim = (-100, 100))EegFun.plot_channel_summary! Method
plot_channel_summary!(fig::Figure, ax::Axis, dat::DataFrame, col::Symbol; kwargs...)
plot_channel_summary(dat::DataFrame, col::Symbol; kwargs...)Plot a bar chart summarizing a specific metric per channel from a DataFrame.
Assumes the DataFrame dat contains at least two columns:
:channel: Containing channel names or identifiers (will be used for x-axis labels).col: The column specified by thecolargument, containing the values to plot.
plot_channel_summary!(fig, ax, dat, col; kwargs...)Arguments
fig::Figure: The Makie Figure object to plot on (mutating version only)ax::Axis: The Makie Axis object to plot on (mutating version only)dat::DataFrame: DataFrame containing channel summary data.col::Symbol: The symbol representing the column indatto plot on the y-axis.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
title_fontsize::Int64=16: Font size for title.tick_fontsize::Int64=12: Font size for tick labels.error_linewidth::Int64=2: Error bar linewidth.display_plot::Bool=true: Display plot.xtick_rotation::Float64=0.7853981633974483: Rotation angle for x-axis tick labels.dims::Nothing=nothing: Tuple (rows, cols) for grid layout. default = _best_rect(n_columns).ygrid::Bool=false: Whether to show y-axis gridbar_width::Float64=0.8: Bar width.bar_alpha::Float64=0.7: Bar alpha.yminorgrid::Bool=false: Whether to show y-axis minor gridxlabel::String=Electrode: x-axis label.xminorgrid::Bool=false: Whether to show x-axis minor gridlabel_fontsize::Int64=14: Font size for axis labels.ylabel::String=: y-axis labelxgrid::Bool=false: Whether to show x-axis gridtitle::String=: Plot title.sort_values::Bool=false: Sort the bars by the values in thecolcolumn in descending order.average_over::Nothing=nothing: Column to average over (e.g., :epoch). If specified, will compute mean ± 95% CI.bar_color::Symbol=steelblue: Bar color.error_color::Symbol=black: Error bar color.
Returns
Mutating version:
nothing(modifies the provided figure and axis in-place)Non-mutating version:
(fig::Figure, ax::Axis)- The created figure and axis objects
Examples
# Non-mutating version (creates new figure)
fig, ax = plot_channel_summary(summary_df, :kurtosis)
# Mutating version (plots on existing figure)
fig = Figure()
ax = Axis(fig[1, 1])
plot_channel_summary!(fig, ax, summary_df, :kurtosis)
# Customize appearance
fig, ax = plot_channel_summary(summary_df, :kurtosis,
bar_color = :red,
title = "Custom Title",
sort_values = true)
# With averaging and error bars
fig, ax = plot_channel_summary(summary_df, :kurtosis,
average_over = :epoch,
error_color = :blue,
error_linewidth = 3)EegFun.plot_channel_summary Method
plot_channel_summary(dat::DataFrame, col::Symbol; kwargs...)Plot a bar chart summarizing a specific metric per channel. Creates a new figure.
See plot_channel_summary! for full documentation of arguments and keyword arguments.
Returns
(fig::Figure, ax::Axis)- The created figure and axis objects
EegFun.plot_confusion_matrix Method
plot_confusion_matrix(decoded::DecodedData; time_point::Union{Float64, Int, Nothing} = nothing, kwargs...)Plot confusion matrix for decoding results.
Arguments
decoded::DecodedData: DecodedData object containing confusion matricestime_point::Union{Float64, Int, Nothing}: Time point to plot (in seconds or index). If nothing, plots average across all time pointskwargs: Additional keyword arguments
Examples
# Plot confusion matrix at a specific time point
plot_confusion_matrix(decoded, time_point=0.3)
# Plot average confusion matrix
plot_confusion_matrix(decoded)EegFun.plot_correlation_heatmap! Method
plot_correlation_heatmap!(fig::Figure, ax::Axis, corr_df::DataFrame; kwargs...)Plot a heatmap of a correlation matrix stored in a DataFrame on the provided figure and axis.
This is the mutating version that plots directly on the provided fig and ax objects.
Arguments
fig::Figure: The Makie Figure object to plot onax::Axis: The Makie Axis object to plot oncorr_df::DataFrame: DataFrame containing the correlation matrix. First column for row labels, rest for correlation values.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
colorbar_position::Tuple{Int64, Int64}=(1, 2): Position of the colorbar as (row, col) tuplecolormap::Symbol=jet: Colormap for the heatmapyminorgrid::Bool=false: Whether to show y-axis minor gridcolorbar_fontsize::Int64=12: Font size for colorbar labelxminorgrid::Bool=false: Whether to show x-axis minor gridlabel_fontsize::Int64=14: Font size for axis labelsylabel::String=: Label for y-axistitle::String=: Plot titlecolorbar_label::String=Correlation: Label for the colorbarnan_color::Symbol=transparent: Color for NaN valuesdisplay_plot::Bool=true: Whether to display the plotygrid::Bool=false: Whether to show y-axis gridcolorbar_width::Int64=30: Width of the colorbarxlabel::String=: Label for x-axiscolorrange::Tuple{Int64, Int64}=(-1, 1): Color range for the heatmap and colorbar (should be -1 to 1 for correlations)show_title::Bool=true: Whether to show the titlemask_range::Nothing=nothing: Optional tuple (min_val, max_val) to mask correlations within this rangeytick_rotation::Int64=0: Rotation angle for y-axis tick labelsxgrid::Bool=false: Whether to show x-axis gridcolorbar_plot::Bool=true: Whether to display the colorbartitle_fontsize::Int64=16: Font size for the titlextick_rotation::Float64=0.7853981633974483: Rotation angle for x-axis tick labelstick_fontsize::Int64=12: Font size for tick labels
Returns
Mutating version:
nothing(modifies the provided figure and axis in-place)Non-mutating version:
(fig::Figure, ax::Axis)- The created figure and axis objects
Examples
# Generate sample correlation data
labels = ["Ch1", "Ch2", "Ch3", "Ch4"]
matrix = cor(rand(100, 4))
corr_df = DataFrame(matrix, labels)
insertcols!(corr_df, 1, :row => labels) # Add row label column
# Non-mutating version (creates new figure)
fig, ax = plot_correlation_heatmap(corr_df)
# Mutating version (plots on existing figure)
fig = Figure()
ax = Axis(fig[1, 1])
plot_correlation_heatmap!(fig, ax, corr_df)
# Customize appearance
fig, ax = plot_correlation_heatmap(corr_df;
mask_range = (-0.3, 0.3),
colormap = :plasma,
colorbar_label = "Custom Label")EegFun.plot_correlation_heatmap Method
plot_correlation_heatmap(corr_df::DataFrame; kwargs...)Plot a heatmap of a correlation matrix. Creates a new figure.
See plot_correlation_heatmap! for full documentation of arguments and keyword arguments.
Returns
(fig::Figure, ax::Axis)- The created figure and axis objects
EegFun.plot_databrowser Function
Load data from a .jld2 file or pattern and open the data browser.
EegFun.plot_databrowser Function
Open a separate data browser window for each dataset in the vector.
sourceEegFun.plot_decoding Method
plot_decoding(decoded::DecodedData; kwargs...)Plot decoding accuracy over time.
Creates a line plot showing classification accuracy at each time point, with optional error bars and chance level reference line.
Arguments
decoded::DecodedData: DecodedData object containing decoding resultskwargs: Additional keyword arguments (see PLOT_DECODING_KWARGS)
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
chance_linestyle::Symbol=dash: Line style for chance levelylim::Nothing=nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedsig_alpha::Float64=0.5: Transparency for significance markersylabel::String=Classification Accuracy: Label for y-axislinestyle::Symbol=solid: Line stylefigure_title::String=Decoding Results: Title for the plot windowtitle::String=: Plot titlefigure_padding::NTuple{4, Int64}=(10, 10, 10, 10): Padding around entire figure as (left, right, top, bottom) tuple (in pixels)display_plot::Bool=true: Display the plot (true/false)interactive::Bool=true: Enable interactive features (true/false)xlim::Nothing=nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedygrid::Bool=true: Show y-axis grid (true/false)xlabel::String=Time (s): Label for x-axissig_color::Symbol=black: Color for significance markerserror_alpha::Float64=0.3: Transparency for error shadingcolor::Symbol=blue: Color for decoding curveshow_title::Bool=true: Show title (true/false)chance_linewidth::Int64=1: Line width for chance levelchance_color::Symbol=gray: Color for chance level lineshow_error::Bool=true: Show standard error bars (true/false)xgrid::Bool=true: Show x-axis grid (true/false)add_xy_origin::Bool=true: Add origin lines at x=0 and y=chance (true/false)linewidth::Int64=2: Line width for decoding curveerror_color::Symbol=blue: Color for error bars
Examples
# Basic plot
plot_decoding(decoded)
# Custom styling
plot_decoding(decoded, color=:red, linewidth=3, show_error=false)
# With custom title
plot_decoding(decoded, title="Face vs. Object Decoding")plot_decoding(filepath::String; input_dir=pwd(), participant_selection=participants(), kwargs...)Load decoded data and plot. Accepts either a .jld2 filepath or a pattern to discover and plot all matching files (one plot per file).
Examples
plot_decoding("decoded.jld2")
plot_decoding("decoded")EegFun.plot_ecg_component_features Method
plot_ecg_component_features(identified_comps::Vector{Int64}, metrics_df::DataFrame)Create a simplified visualization of ECG component detection metrics.
Arguments
identified_comps::Vector{Int64}: Vector of component indices identified as ECG artifactsmetrics_df::DataFrame: DataFrame with component metrics
Returns
fig::Figure: The Makie Figure containing the plot
EegFun.plot_eog_component_features Method
plot_eog_component_features(identified_comps::Dict, metrics_df::DataFrame; kwargs...)Plot z-scores of EOG correlations from the metrics DataFrame and highlight identified components.
Uses the results from identify_eye_components.
Arguments
identified_comps::Dict: Dictionary returned byidentify_eye_components(containing:vEOG,:hEOG).metrics_df::DataFrame: DataFrame returned byidentify_eye_components. Expected to have columns:vEOG_zscore,:hEOG_zscore, and:Component.
Keyword Arguments
z_threshold::Float64: Z-score threshold to draw lines on the plot (default: 3.0).display_plot::Bool: Whether to display the plot (default: true).
Returns
- Named tuple
(fig, axes)whereaxes = (ax_v, ax_h).
EegFun.plot_epochs Method
plot_epochs(filename::String;
input_dir::String = pwd(),
participant_selection::Function = participants(),
channel_selection::Function = channels(),
sample_selection::Function = samples(),
interval_selection::Interval = times(),
epoch_selection::Function = epochs(),
include_extra::Bool = false,
layout = :single,
kwargs...)Load epoch data and create plots. Accepts either a direct .jld2 filepath or a pattern string to discover and plot all matching files (one plot per file).
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
legend_imagecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend imagecolorrange parameterlegend_meshscattercolor::Observables.Observable{Any}=Observable{Any}(:black): Legend meshscattercolor parameterlayout_topo_plot_height::Float64=0.1: Height of individual plots (fraction of figure height)legend_framewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Legend framewidth parameterlegend_linewidth::Observables.Observable{Any}=Observable{Any}(1.5): Legend linewidth parameterlegend_markercolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend markercolormap parameterlegend_surfacecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend surfacecolorrange parameterlegend_patchstrokewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Legend patchstrokewidth parameterlegend_titleposition::Observables.Observable{Any}=Observable{Any}(:top): Legend titleposition parameterlayout_topo_plot_width::Float64=0.1: Width of individual plots (fraction of figure width)plot_avg_trials::Bool=true: Whether to draw ERP average overlayxlim::Nothing=nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedlegend_patchstrokecolor::Observables.Observable{Any}=Observable{Any}(:transparent): Legend patchstrokecolor parameterlegend_markerstrokecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend markerstrokecolor parameterlegend_meshscattersize::Observables.Observable{Any}=Observable{Any}(0.8): Legend meshscattersize parameterxgrid::Bool=false: Whether to show x-axis gridlayout_grid_skip_positions::Nothing=nothing: Positions to skip in grid layout as vector of (row, col) tuples, e.g., [(2,1), (2,3)]legend_patchsize::Observables.Observable{Any}=Observable{Any}((20.0f0, 20.0f0)): Legend patchsize parameteravg_linewidth_multiplier::Float64=2.0: Multiplier for average line width.legend_framecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend framecolor parameterlegend_titlehalign::Observables.Observable{Any}=Observable{Any}(:center): Legend titlehalign parameterlegend_bgcolor::Observables.Observable{Any}=Observable{Any}(nothing): Legend bgcolor parametertrial_alpha::Float64=0.25: Alpha (transparency) for individual trial tracesylim::Nothing=nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool=false: Whether to show x-axis minor gridlegend_position::Symbol=lt: Position of the legend for axislegend() (symbol like :lt, :rt, :lb, :rb, or tuple like (:left, :top), or (0.5, 0.5))layout_topo_margin::Float64=0.12: Margin between plotslegend_labelsize::Observables.Observable{Any}=Observable{Any}(14): Legend labelsize parameterlegend_colgap::Observables.Observable{Any}=Observable{Any}(16): Legend colgap parameterlegend_labelvalign::Observables.Observable{Any}=Observable{Any}(:center): Legend labelvalign parameterlegend_halign::Observables.Observable{Any}=Observable{Any}(:right): Legend halign parametertitle::Nothing=nothing: Plot title. If nothing, automatically determinedlegend_backgroundcolor::Observables.Observable{Any}=Observable{Any}(:white): Legend backgroundcolor parameterlegend_alpha::Observables.Observable{Any}=Observable{Any}(1): Legend alpha parameterlegend_titlevalign::Observables.Observable{Any}=Observable{Any}(:center): Legend titlevalign parameteryreversed::Bool=false: Whether to reverse the y-axislegend_markercolor::Observables.Observable{Any}=Observable{Any}(:black): Legend markercolor parameterlegend_labels::Vector{Any}=Any[]: If plotting multiple plots, custom labels for conditions.legend_height::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Legend height parameterlegend_surfacedata::Observables.Observable{Any}=Observable{Any}((-0.7 .. 0.7, -0.7 .. 0.7, [-0.21875 0.17499999999999996 0.48125000000000007 0.7000000000000001 0.8312499999999999 0.875 0.8312499999999999 0.7000000000000001 0.48125000000000007 0.17499999999999996 -0.21875; -0.112 0.08959999999999999 0.24640000000000004 0.35840000000000005 0.4256 0.448 0.4256 0.35840000000000005 0.24640000000000004 0.08959999999999999 -0.112; -0.04725 0.03779999999999999 0.10395000000000001 0.1512 0.17955 0.189 0.17955 0.1512 0.10395000000000001 0.03779999999999999 -0.04725; -0.014 0.011199999999999998 0.030800000000000004 0.044800000000000006 0.0532 0.056 0.0532 0.044800000000000006 0.030800000000000004 0.011199999999999998 -0.014; -0.00175 0.0013999999999999998 0.0038500000000000006 0.005600000000000001 0.00665 0.007 0.00665 0.005600000000000001 0.0038500000000000006 0.0013999999999999998 -0.00175; 0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.0; 0.00175 -0.0013999999999999998 -0.0038500000000000006 -0.005600000000000001 -0.00665 -0.007 -0.00665 -0.005600000000000001 -0.0038500000000000006 -0.0013999999999999998 0.00175; 0.014 -0.011199999999999998 -0.030800000000000004 -0.044800000000000006 -0.0532 -0.056 -0.0532 -0.044800000000000006 -0.030800000000000004 -0.011199999999999998 0.014; 0.04725 -0.03779999999999999 -0.10395000000000001 -0.1512 -0.17955 -0.189 -0.17955 -0.1512 -0.10395000000000001 -0.03779999999999999 0.04725; 0.112 -0.08959999999999999 -0.24640000000000004 -0.35840000000000005 -0.4256 -0.448 -0.4256 -0.35840000000000005 -0.24640000000000004 -0.08959999999999999 0.112; 0.21875 -0.17499999999999996 -0.48125000000000007 -0.7000000000000001 -0.8312499999999999 -0.875 -0.8312499999999999 -0.7000000000000001 -0.48125000000000007 -0.17499999999999996 0.21875])): Legend surfacedata parameterygrid::Bool=false: Whether to show y-axis gridlayout_grid_colgap::Int64=10: Gap between columns (in pixels)legend_linecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend linecolorrange parameterlegend_heatmaplimits::Observables.Observable{Any}=Observable{Any}((0 .. 1, 0 .. 1)): Legend heatmaplimits parameterlegend_meshscatterrotation::Observables.Observable{Any}=Observable{Any}(1.0 + 0.0im + 0.0jm + 0.0km): Legend meshscatterrotation parameterlegend_heatmapvalues::Observables.Observable{Any}=Observable{Any}([0.0 0.3; 0.6 1.0]): Legend heatmapvalues parameterlegend_tellheight::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend tellheight parametercolor::Symbol=black: Color for epoch traces (can be a single color or a vector of colors, one per condition)legend_margin::Observables.Observable{Any}=Observable{Any}((6, 6, 6, 6)): Legend margin parameterlegend_polypoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]): Legend polypoints parameterlegend_channel::Vector{Any}=Any[]: If plotting multiple plots, within channel to put the legend on.legend_imagevalues::Observables.Observable{Any}=Observable{Any}([0.0 0.3; 0.6 1.0]): Legend imagevalues parameterlayout_grid_rowgap::Int64=10: Gap between rows (in pixels)legend_labelfont::Observables.Observable{Any}=Observable{Any}(:regular): Legend labelfont parameterlegend_orientation::Observables.Observable{Any}=Observable{Any}(:vertical): Legend orientation parameterlinewidth::Int64=1: Line width for epoch traceslegend_polycolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.4, 0.4, 0.4)): Legend polycolor parameterlayout_grid_dims::Nothing=nothing: Grid dimensions as (rows, cols) tuple for grid layouts. If nothing, automatically determinedlegend_linepoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.0, 0.5], [1.0, 0.5]]): Legend linepoints parameterlegend_surfacecolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend surfacecolormap parameterlegend_alignmode::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Inside()): Legend alignmode parametercolormap::Symbol=jet: Colormap for multi-condition plotsyminorgrid::Bool=false: Whether to show y-axis minor gridlegend_heatmapcolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend heatmapcolorrange parameterlegend_meshcolor::Observables.Observable{Any}=Observable{Any}(RGBA{Float32}(0.0, 0.44705883, 0.69803923, 1.0)): Legend meshcolor parameterlegend_label::String=: Title for the legendlegend_titlesize::Observables.Observable{Any}=Observable{Any}(14): Legend titlesize parameterlegend_patchcolor::Observables.Observable{Any}=Observable{Any}(:transparent): Legend patchcolor parameterylabel::String=μV: Label for y-axislegend_framevisible::Bool=true: Whether to show the frame of the legendlegend_polycolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend polycolorrange parameterlegend_groupgap::Observables.Observable{Any}=Observable{Any}(16): Legend groupgap parameterdisplay_plot::Bool=true: Whether to display the plotaverage_channels::Bool=false: Whether to average across channelslayout_topo_show_scale::Bool=false: Whether to show a scale axis in topo layoutinteractive::Bool=true: Whether to enable interactive featureslegend_labelcolor::Observables.Observable{Any}=Observable{Any}(:black): Legend labelcolor parameterlegend_meshcolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend meshcolorrange parameterlegend::Bool=true: Whether to show the legendxlabel::String=Time (s): Label for x-axislegend_polystrokecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend polystrokecolor parameterlegend_linestyle::Observables.Observable{Any}=Observable{Any}(:solid): Legend linestyle parameterlegend_meshscattermarker::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Sphere{Float32}(Float32[0.0, 0.0, 0.0], 1.0f0)): Legend meshscattermarker parameterlegend_mesh::Observables.Observable{Any}=Observable{Any}(GeometryBasics.HyperRectangle{3, Float32}(Float32[-0.7, -0.7, -0.7], Float32[1.4, 1.4, 1.4])): Legend mesh parameterlegend_linecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend linecolor parameterlegend_meshcolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend meshcolormap parameterlegend_meshscatterpoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{3, Float32}[[0.0, 0.0, 0.0]]): Legend meshscatterpoints parameterlegend_nbanks::Nothing=nothing: Number of columns for the legend. If nothing, automatically determined.add_xy_origin::Bool=true: Whether to add origin lines at x=0 and y=0legend_labelhalign::Observables.Observable{Any}=Observable{Any}(:left): Legend labelhalign parameterlegend_polycolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend polycolormap parameterlegend_rowgap::Observables.Observable{Any}=Observable{Any}(3): Legend rowgap parameterlegend_gridsvalign::Observables.Observable{Any}=Observable{Any}(:center): Legend gridsvalign parameterlegend_valign::Observables.Observable{Any}=Observable{Any}(:top): Legend valign parameterlegend_surfacevalues::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend surfacevalues parameterlayout_topo_scale_pos::Tuple{Float64, Float64}=(0.0, 0.0): Fallback position for scale plot in topo layout as (x, y) tuplelegend_markerstrokewidth::Observables.Observable{Any}=Observable{Any}(0): Legend markerstrokewidth parameterlegend_marker::Observables.Observable{Any}=Observable{Any}(:circle): Legend marker parameterlegend_meshscattercolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend meshscattercolormap parameterlegend_polystrokewidth::Observables.Observable{Any}=Observable{Any}(0): Legend polystrokewidth parametertheme_fontsize::Int64=24: Font size for themelegend_labeljustification::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend labeljustification parameterfigure_padding::NTuple{4, Int64}=(10, 10, 10, 10): Padding around entire figure as (left, right, top, bottom) tuple (in pixels)legend_tellwidth::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend tellwidth parameterlegend_patchlabelgap::Observables.Observable{Any}=Observable{Any}(5): Legend patchlabelgap parameterlegend_markersize::Observables.Observable{Any}=Observable{Any}(9): Legend markersize parameterlegend_width::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Legend width parameterlegend_titlecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend titlecolor parameterlegend_imagelimits::Observables.Observable{Any}=Observable{Any}((0 .. 1, 0 .. 1)): Legend imagelimits parameterlegend_linecolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend linecolormap parameterlegend_padding::Observables.Observable{Any}=Observable{Any}((6.0f0, 6.0f0, 6.0f0, 6.0f0)): Legend padding parameterlegend_meshscattercolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend meshscattercolorrange parameterlayout::Symbol=single: Layout type: :single, :grid, or :topolegend_markercolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend markercolorrange parameterlegend_gridshalign::Observables.Observable{Any}=Observable{Any}(:center): Legend gridshalign parameterlegend_titlevisible::Observables.Observable{Any}=Observable{Any}(true): Legend titlevisible parameterlegend_titlegap::Observables.Observable{Any}=Observable{Any}(8): Legend titlegap parameterlegend_markerpoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.5, 0.5]]): Legend markerpoints parameterlegend_titlefont::Observables.Observable{Any}=Observable{Any}(:bold): Legend titlefont parameter
Examples
plot_epochs("epochs_original.jld2")
plot_epochs("epochs_original")
plot_epochs("epochs_original", participant_selection = participants(1))EegFun.plot_erp! Method
plot_erp!(fig::Figure, ax::Axis, dat::ErpData; kwargs...)Plot ERP data on an existing axis, mutating the figure and axis.
Arguments
fig::Figure: The figure to plot onax::Axis: The axis to plot ondat::ErpData: The ERP data to plotkwargs...: Additional plotting arguments (see PLOT_ERP_KWARGS)
Returns
ax::Axis: The axis that was plotted on
EegFun.plot_erp Method
plot_erp(filepath::String;
input_dir::String = pwd(),
participant_selection::Function = participants(),
layout::Union{Symbol, PlotLayout} = :single,
condition_selection::Function = conditions(),
channel_selection::Function = channels(),
channel_plot_order::Union{Nothing, Vector{Symbol}} = nothing,
sample_selection::Function = samples(),
interval_selection::Interval = times(),
baseline_interval::Interval = times(),
kwargs...)Load ERP data and create plots. Accepts either a direct .jld2 filepath or a filename pattern to discover and plot all matching files.
Arguments
filepath::String: Either a.jld2file path, or a pattern string (e.g."erps_good") to match against files ininput_dirinput_dir::String: Directory to search for pattern-matched files (default:pwd())participant_selection::Function: Participant filter for pattern mode (default:participants())layout: Layout specification (see main plot_erp documentation)channel_selection::Function: Function that returns boolean vector for channel filteringsample_selection::Function: Function that returns boolean vector for sample filteringkwargs: Additional keyword arguments
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
legend_imagecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend imagecolorrange parameterlegend_meshscattercolor::Observables.Observable{Any}=Observable{Any}(:black): Legend meshscattercolor parameterlayout_topo_plot_height::Float64=0.05: Height of individual plots (fraction of figure height)legend_framewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Legend framewidth parameterlegend_linewidth::Observables.Observable{Any}=Observable{Any}(1.5): Legend linewidth parameterlegend_markercolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend markercolormap parameterlegend_surfacecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend surfacecolorrange parameterlegend_patchstrokewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Legend patchstrokewidth parameterlegend_titleposition::Observables.Observable{Any}=Observable{Any}(:top): Legend titleposition parameterlayout_topo_plot_width::Float64=0.05: Width of individual plots (fraction of figure width)legend_patchstrokecolor::Observables.Observable{Any}=Observable{Any}(:transparent): Legend patchstrokecolor parameterxlim::Nothing=nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedlegend_markerstrokecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend markerstrokecolor parameterxticks::Nothing=nothing: X-axis tick positions (e.g., -0.1:0.1:0.8 or [0, 0.2, 0.4]). If nothing, automatically determinedshow_title::Bool=true: Show title (true/false)legend_meshscattersize::Observables.Observable{Any}=Observable{Any}(0.8): Legend meshscattersize parameterxgrid::Bool=false: Show x-axis grid (true/false)layout_grid_skip_positions::Nothing=nothing: Positions to skip in grid layout as vector of (row, col) tuples, e.g., [(2,1), (2,3)]legend_patchsize::Observables.Observable{Any}=Observable{Any}((20.0f0, 20.0f0)): Legend patchsize parameterlegend_framecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend framecolor parameterlegend_titlehalign::Observables.Observable{Any}=Observable{Any}(:center): Legend titlehalign parameterlegend_bgcolor::Observables.Observable{Any}=Observable{Any}(nothing): Legend bgcolor parameterylim::Nothing=nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool=false: Show x-axis minor grid (true/false)legend_position::Symbol=lt: Legend position (:lt, :rt, :lb, :rb, or tuple like (:left, :top), or (0.5, 0.5))legend_labelsize::Observables.Observable{Any}=Observable{Any}(14): Legend labelsize parameterlinestyle::Symbol=solid: Line style for ERPs (single style or a vector of styles, one per dataset)legend_colgap::Observables.Observable{Any}=Observable{Any}(16): Legend colgap parameterlegend_labelvalign::Observables.Observable{Any}=Observable{Any}(:center): Legend labelvalign parameterlegend_halign::Observables.Observable{Any}=Observable{Any}(:right): Legend halign parameterfigure_title::String=ERP Plot: Title for the plot windowtitle::String=: Plot titlelegend_alpha::Observables.Observable{Any}=Observable{Any}(1): Legend alpha parameterlegend_titlevalign::Observables.Observable{Any}=Observable{Any}(:center): Legend titlevalign parameteryreversed::Bool=false: Whether to reverse the y-axislegend_backgroundcolor::Observables.Observable{Any}=Observable{Any}(:white): Legend backgroundcolor parameterlegend_markercolor::Observables.Observable{Any}=Observable{Any}(:black): Legend markercolor parameterlegend_labels::Vector{Any}=Any[]: Legend labels.legend_height::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Legend height parameterlegend_surfacedata::Observables.Observable{Any}=Observable{Any}((-0.7 .. 0.7, -0.7 .. 0.7, [-0.21875 0.17499999999999996 0.48125000000000007 0.7000000000000001 0.8312499999999999 0.875 0.8312499999999999 0.7000000000000001 0.48125000000000007 0.17499999999999996 -0.21875; -0.112 0.08959999999999999 0.24640000000000004 0.35840000000000005 0.4256 0.448 0.4256 0.35840000000000005 0.24640000000000004 0.08959999999999999 -0.112; -0.04725 0.03779999999999999 0.10395000000000001 0.1512 0.17955 0.189 0.17955 0.1512 0.10395000000000001 0.03779999999999999 -0.04725; -0.014 0.011199999999999998 0.030800000000000004 0.044800000000000006 0.0532 0.056 0.0532 0.044800000000000006 0.030800000000000004 0.011199999999999998 -0.014; -0.00175 0.0013999999999999998 0.0038500000000000006 0.005600000000000001 0.00665 0.007 0.00665 0.005600000000000001 0.0038500000000000006 0.0013999999999999998 -0.00175; 0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.0; 0.00175 -0.0013999999999999998 -0.0038500000000000006 -0.005600000000000001 -0.00665 -0.007 -0.00665 -0.005600000000000001 -0.0038500000000000006 -0.0013999999999999998 0.00175; 0.014 -0.011199999999999998 -0.030800000000000004 -0.044800000000000006 -0.0532 -0.056 -0.0532 -0.044800000000000006 -0.030800000000000004 -0.011199999999999998 0.014; 0.04725 -0.03779999999999999 -0.10395000000000001 -0.1512 -0.17955 -0.189 -0.17955 -0.1512 -0.10395000000000001 -0.03779999999999999 0.04725; 0.112 -0.08959999999999999 -0.24640000000000004 -0.35840000000000005 -0.4256 -0.448 -0.4256 -0.35840000000000005 -0.24640000000000004 -0.08959999999999999 0.112; 0.21875 -0.17499999999999996 -0.48125000000000007 -0.7000000000000001 -0.8312499999999999 -0.875 -0.8312499999999999 -0.7000000000000001 -0.48125000000000007 -0.17499999999999996 0.21875])): Legend surfacedata parameterygrid::Bool=false: Show y-axis grid (true/false)layout_grid_colgap::Int64=10: Gap between columns (in pixels)legend_linecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend linecolorrange parameterlegend_heatmaplimits::Observables.Observable{Any}=Observable{Any}((0 .. 1, 0 .. 1)): Legend heatmaplimits parameterlegend_meshscatterrotation::Observables.Observable{Any}=Observable{Any}(1.0 + 0.0im + 0.0jm + 0.0km): Legend meshscatterrotation parameterlegend_heatmapvalues::Observables.Observable{Any}=Observable{Any}([0.0 0.3; 0.6 1.0]): Legend heatmapvalues parameterlegend_tellheight::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend tellheight parametercolor::Symbol=black: Color for ERPs (single color or a vector of colors, one per dataset)legend_margin::Observables.Observable{Any}=Observable{Any}((6, 6, 6, 6)): Legend margin parameterlegend_polypoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]): Legend polypoints parameterlegend_channel::Vector{Any}=Any[]: Which channel to put the legend on.legend_imagevalues::Observables.Observable{Any}=Observable{Any}([0.0 0.3; 0.6 1.0]): Legend imagevalues parameterlayout_grid_rowgap::Int64=10: Gap between rows (in pixels)legend_labelfont::Observables.Observable{Any}=Observable{Any}(:regular): Legend labelfont parameterlegend_orientation::Observables.Observable{Any}=Observable{Any}(:vertical): Legend orientation parameterlinewidth::Int64=2: Line width for ERPslayout_topo_scale_offset::Float64=0.1: Offset factor for scale plot positionlegend_polycolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.4, 0.4, 0.4)): Legend polycolor parameterlegend_linepoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.0, 0.5], [1.0, 0.5]]): Legend linepoints parameterlayout_grid_dims::Nothing=nothing: Grid dimensions as (rows, cols) tuple for grid layouts. If nothing, automatically determinedlegend_surfacecolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend surfacecolormap parameterlegend_alignmode::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Inside()): Legend alignmode parametercolormap::Symbol=jet: Colormap for multi-channel plotsyminorgrid::Bool=false: Show y-axis minor grid (true/false)time_unit::Symbol=s: Time unit for x-axis display (😒 or :ms). Only affects axis labels and tick formatting — all intervals remain in seconds.legend_heatmapcolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend heatmapcolorrange parameterlegend_meshcolor::Observables.Observable{Any}=Observable{Any}(RGBA{Float32}(0.0, 0.44705883, 0.69803923, 1.0)): Legend meshcolor parameterlegend_label::String=: Title for the legendlegend_titlesize::Observables.Observable{Any}=Observable{Any}(14): Legend titlesize parameterlegend_patchcolor::Observables.Observable{Any}=Observable{Any}(:transparent): Legend patchcolor parameterylabel::String=μV: Label for y-axislegend_framevisible::Bool=true: Legend frame visible (true/false)legend_polycolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend polycolorrange parameterlegend_groupgap::Observables.Observable{Any}=Observable{Any}(16): Legend groupgap parameterdisplay_plot::Bool=true: Display the plot (true/false)interactive::Bool=true: Enable interactive features (true/false)average_channels::Bool=false: Average across channels (true/false)legend_meshcolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend meshcolorrange parameterlegend_labelcolor::Observables.Observable{Any}=Observable{Any}(:black): Legend labelcolor parameterlegend::Bool=true: Show the legend (true/false)xlabel::String=Time (s): Label for x-axislegend_polystrokecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend polystrokecolor parameterlegend_linestyle::Observables.Observable{Any}=Observable{Any}(:solid): Legend linestyle parameterlegend_meshscattermarker::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Sphere{Float32}(Float32[0.0, 0.0, 0.0], 1.0f0)): Legend meshscattermarker parameterlegend_mesh::Observables.Observable{Any}=Observable{Any}(GeometryBasics.HyperRectangle{3, Float32}(Float32[-0.7, -0.7, -0.7], Float32[1.4, 1.4, 1.4])): Legend mesh parameterlegend_linecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend linecolor parameterlegend_meshcolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend meshcolormap parameterhighlight_regions::Nothing=nothing: Highlight regions as a NamedTuple or Vector of NamedTuples. Each region: (x1, x2, y1=-Inf, y2=Inf, color=:gray, alpha=0.3)legend_meshscatterpoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{3, Float32}[[0.0, 0.0, 0.0]]): Legend meshscatterpoints parameterlegend_nbanks::Nothing=nothing: Number of legend columns.add_xy_origin::Bool=true: Add origin lines at x=0 and y=0 (true/false)legend_labelhalign::Observables.Observable{Any}=Observable{Any}(:left): Legend labelhalign parameterlegend_polycolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend polycolormap parameterlegend_rowgap::Observables.Observable{Any}=Observable{Any}(3): Legend rowgap parameterlegend_gridsvalign::Observables.Observable{Any}=Observable{Any}(:center): Legend gridsvalign parameterlegend_valign::Observables.Observable{Any}=Observable{Any}(:top): Legend valign parameterlegend_surfacevalues::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend surfacevalues parameterlayout_topo_scale_pos::Tuple{Float64, Float64}=(0.8, -0.8): Fallback position for scale plot in topo layout as (x, y) tuplelegend_markerstrokewidth::Observables.Observable{Any}=Observable{Any}(0): Legend markerstrokewidth parameterlegend_marker::Observables.Observable{Any}=Observable{Any}(:circle): Legend marker parameterlegend_meshscattercolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend meshscattercolormap parameterlegend_polystrokewidth::Observables.Observable{Any}=Observable{Any}(0): Legend polystrokewidth parameterlegend_labeljustification::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend labeljustification parameterfigure_padding::NTuple{4, Int64}=(10, 10, 10, 10): Padding around entire figure as (left, right, top, bottom) tuple (in pixels)legend_tellwidth::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend tellwidth parameterlegend_patchlabelgap::Observables.Observable{Any}=Observable{Any}(5): Legend patchlabelgap parameterlegend_markersize::Observables.Observable{Any}=Observable{Any}(9): Legend markersize parameterlegend_width::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Legend width parameterlegend_titlecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend titlecolor parameterlegend_imagelimits::Observables.Observable{Any}=Observable{Any}((0 .. 1, 0 .. 1)): Legend imagelimits parameterlegend_linecolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend linecolormap parameterlegend_padding::Observables.Observable{Any}=Observable{Any}((6.0f0, 6.0f0, 6.0f0, 6.0f0)): Legend padding parameterlegend_meshscattercolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend meshscattercolorrange parameterlegend_markercolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend markercolorrange parameterlegend_gridshalign::Observables.Observable{Any}=Observable{Any}(:center): Legend gridshalign parameterlegend_titlevisible::Observables.Observable{Any}=Observable{Any}(true): Legend titlevisible parameterlegend_titlegap::Observables.Observable{Any}=Observable{Any}(8): Legend titlegap parameterlegend_markerpoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.5, 0.5]]): Legend markerpoints parameteryticks::Nothing=nothing: Y-axis tick positions (e.g., -4:2:4 or [-2, 0, 2]). If nothing, automatically determinedlegend_titlefont::Observables.Observable{Any}=Observable{Any}(:bold): Legend titlefont parameter
Examples
# Load and plot from file
plot_erp("grand_average_erps_good.jld2")
# Plot all files matching pattern in current directory
plot_erp("erps_good")
# Plot specific participant
plot_erp("erps_good", participant_selection = participants(1))
# With channel selection
plot_erp("erps_good", channel_selection = channels([:PO7, :PO8]), layout = :grid)EegFun.plot_erp_image Method
plot_erp_image(dat::EpochData;
layout::Union{Symbol, PlotLayout} = :single,
channel_selection::Function = channels(),
channel_plot_order::Union{Nothing, Vector{Symbol}} = nothing,
sample_selection::Function = samples(),
interval_selection::Interval = times(),
kwargs...)Plot ERP image for specified channels and samples with flexible layout options.
Arguments
dat::EpochData: Epoch data structurelayout: Layout specification::single(default): Single ERP image plot:grid: Auto-calculated grid layout for multiple channels:topo: Topographic layout based on channel positionsPlotLayout: Custom layout objectVector{Int}: Custom grid dimensions [rows, cols]
channel_selection::Function: Function that returns boolean vector for channel filtering (default: channels() - all channels)sample_selection::Function: Function that returns boolean vector for sample filtering (default: samples() - all samples)
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
colorbar_position::Tuple{Int64, Int64}=(1, 2): Position of the colorbar as (row, col) tuplelayout_grid_dims::Nothing=nothing: Grid dimensions as (rows, cols) tuple for grid layouts. If nothing, automatically determinedcolormap::Symbol=jet: Colormap for the imageyminorgrid::Bool=false: Show y-axis minor grid (true/false)layout_topo_plot_height::Float64=0.07: Height of individual plots (fraction of figure height)ylim::Nothing=nothing: Y-axis limits for ERP waveform as (min, max) tuple. If nothing, automatically determinedcolorbar_plot_numbers::Vector{Any}=Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.layout_topo_scale_pos::Tuple{Float64, Float64}=(0.95, 0.05): Fallback position for scale plot in topo layout as (x, y) tuplexminorgrid::Bool=false: Show x-axis minor grid (true/false)ylabel::String=Epoch: Label for y-axisfigure_title::String=ERP Image Plot: Title for the plot windowtitle::String=: Plot titleplot_erp::Bool=true: Whether to plot ERP average overlayyreversed::Bool=false: Whether to reverse the y-axiscolorbar_label::String=μV: Label for the colorbarlayout_topo_plot_width::Float64=0.07: Width of individual plots (fraction of figure width)figure_padding::NTuple{4, Int64}=(10, 10, 10, 10): Padding around entire figure as (left, right, top, bottom) tuple (in pixels)display_plot::Bool=true: Display the plot (true/false)interactive::Bool=true: Enable interactive features (true/false)xlim::Nothing=nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedinterpolate::Bool=false: Whether to interpolate the heatmap pixels for smoother appearancecolorbar_width::Int64=30: Width of the colorbar in pixelsygrid::Bool=false: Show y-axis grid (true/false)layout_grid_colgap::Int64=10: Gap between columns (in pixels)xlabel::String=Time (s): Label for x-axiscolorrange::Nothing=nothing: Color range for the image. If nothing, automatically determinedshow_title::Bool=true: Show title (true/false)xgrid::Bool=false: Show x-axis grid (true/false)colorbar_plot::Bool=true: Whether to show the colorbaradd_xy_origin::Bool=true: Add origin lines at x=0 and y=0 (true/false)layout_grid_rowgap::Int64=10: Gap between rows (in pixels)layout_grid_skip_positions::Nothing=nothing: Positions to skip in grid layout as vector of (row, col) tuples, e.g., [(2,1), (2,3)]boxcar_average::Int64=1: Boxcar average window size for smoothing the ERP image (1 = no smoothing)
Returns
Figure: The Makie Figure objectVector{Axis}: Vector of axes for the ERP images
Examples
# Plot all channels and samples
plot_erp_image(dat)
# Plot specific channels
plot_erp_image(dat, channel_selection = channels([:Fp1, :Fp2]))
# Exclude reference channels
plot_erp_image(dat, channel_selection = channels_not([:M1, :M2]))
# Plot frontal channels only
plot_erp_image(dat, channel_selection = channels(1:10))
# Custom predicates
plot_erp_image(dat,
channel_selection = x -> startswith.(string.(x), "F"),
sample_selection = x -> x .> 0.0 # Only positive time points
)EegFun.plot_erp_measurements Method
plot_erp_measurements(erp_data, analysis_type;
analysis_interval, baseline_interval,
layout, channel_selection, condition_selection, kwargs...)Plot ERP data with measurement overlays computed inline.
Computes a single measurement type across all selected channels and conditions, then overlays the results on the ERP waveforms. Combines measurement computation and visualization in one call.
Arguments
erp_data::Union{String, ErpData, Vector{ErpData}}: ERP data (filepath or data object)analysis_type::String: Measurement type (e.g. "mean_amplitude", "max_peak_latency")
Keyword Arguments
analysis_interval::Tuple{Real,Real}: Time interval for measurement (default: full range)baseline_interval::Union{Tuple{Real,Real},Nothing}: Baseline interval for correction (default: nothing)layout::Union{Symbol, PlotLayout}: Plot layout — :single, :grid, or :topo (default: :single)channel_selection::Function: Channel selection predicate (default: all channels)condition_selection::Function: Condition selection predicate (default: all conditions)kwargs...: Additional arguments passed toplot_erpanderp_measurements
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
fractional_area_fraction::Float64=0.5: Fraction for fractional area latency (0.0-1.0). Finds latency where this fraction of area is to the left.fractional_peak_fraction::Float64=0.5: Fraction for fractional peak latency (0.0-1.0). Finds latency where amplitude is this fraction of peak.fractional_peak_direction::Symbol=onset: Direction for fractional peak latency: :onset (before peak) or :offset (after peak)local_interval::Int64=3: Number of samples on each side of peak (total interval = 2*local_interval + 1). Peak must be larger than neighbors and local averages within this window.
Overlay Types
Peak amplitude → vertical line at peak time, amplitude label
Peak latency → vertical line at latency, time label
Peak-to-peak → vertical lines at both peaks
Mean amplitude → shaded analysis interval + horizontal mean line
Area/integral → shaded analysis interval
Fractional latency → vertical line at fractional latency point
Examples
dat = EegFun.read_data("erps_good.jld2")
# Mean amplitude in 300-500ms interval
plot_erp_measurements(dat, "mean_amplitude",
analysis_interval = (0.3, 0.5),
baseline_interval = (-0.2, 0.0))
# Peak latency
plot_erp_measurements(dat, "max_peak_latency",
analysis_interval = (0.0, 0.8),
baseline_interval = (-0.2, 0.0),
channel_selection = channels([:Cz, :Pz]))
# Load from file path
plot_erp_measurements("erps_good.jld2", "max_peak_amplitude",
analysis_interval = (0.1, 0.3))EegFun.plot_erp_stats Method
plot_erp_stats(result::StatsResult;
layout::Union{Symbol, PlotLayout} = :single,
channel_selection::Function = channels(),
channel_plot_order::Union{Nothing, Vector{Symbol}} = nothing,
plot_erp::Bool = true,
plot_difference::Bool = false,
plot_tvalues::Bool = false,
plot_significance::Bool = false,
plot_critical_t::Bool = false,
plot_se::Bool = false,
colors::Vector = [:blue, :red, :black, :purple],
difference_offset::Real = 0.0,
significance_position::Union{Symbol, Real} = :auto,
significance_color = (:gray, 0.6),
kwargs...)Plot ERP waveforms and statistical results for analytic or permutation tests with flexible layout support.
Works with both AnalyticResult (from analytic_test) and PermutationResult (from permutation_test).
Arguments
result::StatsResult: Results fromanalytic_testorpermutation_testlayout: Layout specification::single(default): Single plot with selected channels overlaid:grid: Grid layout with one subplot per selected channel:topo: Topographic layout based on channel positionsPlotLayout: Custom layout object
channel_selection::Function: Predicate to select channels (default:channels()- all channels)channel_plot_order::Union{Nothing, Vector{Symbol}}: Override the plotting order of selected channels (default:nothing— data order). When provided, channels are plotted in the specified order. Only channels present in bothchannel_plot_orderand the selection are plottedplot_erp::Bool: Whether to plot ERP waveforms (condition averages) (default: true)plot_difference::Bool: Whether to plot difference wave (A-B) (default: false)plot_tvalues::Bool: Whether to plot t-statistics (default: false)plot_significance::Bool: Whether to highlight significant time points (default: false)plot_critical_t::Bool: Whether to plot critical t-values (default: false). Only relevant whenplot_tvalues=truedifference_offset::Real: Vertical offset for difference wave (default: 0.0). Set to non-zero to shift for visibilityplot_se::Bool: Whether to plot ±1 SEM bands around waveforms (default: false). Bands are drawn around condition ERPs and difference wavesignificance_position::Union{Symbol, Real}: Position for significance bars (default::auto). Options::auto- Automatically place at y=0 if visible, otherwise at bottom (default):zero- Always place at y=0:bottom- Always place at bottom of plot/spineReal- Custom y-position (e.g.,-5.0to place at -5 μV)
significance_color: Color for significance bars (default:(:gray, 0.6)). Can be any Makie color specification
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
legend_imagecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend imagecolorrange parameterlegend_meshscattercolor::Observables.Observable{Any}=Observable{Any}(:black): Legend meshscattercolor parameterlayout_topo_plot_height::Float64=0.05: Height of individual plots (fraction of figure height)legend_framewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Legend framewidth parameterlegend_linewidth::Observables.Observable{Any}=Observable{Any}(1.5): Legend linewidth parameterlegend_markercolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend markercolormap parameterlegend_surfacecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend surfacecolorrange parameterlegend_patchstrokewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Legend patchstrokewidth parameterlegend_titleposition::Observables.Observable{Any}=Observable{Any}(:top): Legend titleposition parameterlayout_topo_plot_width::Float64=0.05: Width of individual plots (fraction of figure width)legend_patchstrokecolor::Observables.Observable{Any}=Observable{Any}(:transparent): Legend patchstrokecolor parameterxlim::Nothing=nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedlegend_markerstrokecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend markerstrokecolor parameterxticks::Nothing=nothing: X-axis tick positions (e.g., -0.1:0.1:0.8 or [0, 0.2, 0.4]). If nothing, automatically determinedshow_title::Bool=true: Show title (true/false)legend_meshscattersize::Observables.Observable{Any}=Observable{Any}(0.8): Legend meshscattersize parameterxgrid::Bool=false: Show x-axis grid (true/false)layout_grid_skip_positions::Nothing=nothing: Positions to skip in grid layout as vector of (row, col) tuples, e.g., [(2,1), (2,3)]legend_patchsize::Observables.Observable{Any}=Observable{Any}((20.0f0, 20.0f0)): Legend patchsize parameterlegend_framecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend framecolor parameterlegend_titlehalign::Observables.Observable{Any}=Observable{Any}(:center): Legend titlehalign parameterlegend_bgcolor::Observables.Observable{Any}=Observable{Any}(nothing): Legend bgcolor parameterylim::Nothing=nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool=false: Show x-axis minor grid (true/false)legend_position::Symbol=lt: Legend position (:lt, :rt, :lb, :rb, or tuple like (:left, :top), or (0.5, 0.5))legend_labelsize::Observables.Observable{Any}=Observable{Any}(14): Legend labelsize parameterlinestyle::Symbol=solid: Line style for ERPs (single style or a vector of styles, one per dataset)legend_colgap::Observables.Observable{Any}=Observable{Any}(16): Legend colgap parameterlegend_labelvalign::Observables.Observable{Any}=Observable{Any}(:center): Legend labelvalign parameterlegend_halign::Observables.Observable{Any}=Observable{Any}(:right): Legend halign parameterfigure_title::String=ERP Plot: Title for the plot windowtitle::String=: Plot titlelegend_alpha::Observables.Observable{Any}=Observable{Any}(1): Legend alpha parameterlegend_titlevalign::Observables.Observable{Any}=Observable{Any}(:center): Legend titlevalign parameteryreversed::Bool=false: Whether to reverse the y-axislegend_backgroundcolor::Observables.Observable{Any}=Observable{Any}(:white): Legend backgroundcolor parameterlegend_markercolor::Observables.Observable{Any}=Observable{Any}(:black): Legend markercolor parameterlegend_labels::Vector{Any}=Any[]: Legend labels.legend_height::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Legend height parameterlegend_surfacedata::Observables.Observable{Any}=Observable{Any}((-0.7 .. 0.7, -0.7 .. 0.7, [-0.21875 0.17499999999999996 0.48125000000000007 0.7000000000000001 0.8312499999999999 0.875 0.8312499999999999 0.7000000000000001 0.48125000000000007 0.17499999999999996 -0.21875; -0.112 0.08959999999999999 0.24640000000000004 0.35840000000000005 0.4256 0.448 0.4256 0.35840000000000005 0.24640000000000004 0.08959999999999999 -0.112; -0.04725 0.03779999999999999 0.10395000000000001 0.1512 0.17955 0.189 0.17955 0.1512 0.10395000000000001 0.03779999999999999 -0.04725; -0.014 0.011199999999999998 0.030800000000000004 0.044800000000000006 0.0532 0.056 0.0532 0.044800000000000006 0.030800000000000004 0.011199999999999998 -0.014; -0.00175 0.0013999999999999998 0.0038500000000000006 0.005600000000000001 0.00665 0.007 0.00665 0.005600000000000001 0.0038500000000000006 0.0013999999999999998 -0.00175; 0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.0; 0.00175 -0.0013999999999999998 -0.0038500000000000006 -0.005600000000000001 -0.00665 -0.007 -0.00665 -0.005600000000000001 -0.0038500000000000006 -0.0013999999999999998 0.00175; 0.014 -0.011199999999999998 -0.030800000000000004 -0.044800000000000006 -0.0532 -0.056 -0.0532 -0.044800000000000006 -0.030800000000000004 -0.011199999999999998 0.014; 0.04725 -0.03779999999999999 -0.10395000000000001 -0.1512 -0.17955 -0.189 -0.17955 -0.1512 -0.10395000000000001 -0.03779999999999999 0.04725; 0.112 -0.08959999999999999 -0.24640000000000004 -0.35840000000000005 -0.4256 -0.448 -0.4256 -0.35840000000000005 -0.24640000000000004 -0.08959999999999999 0.112; 0.21875 -0.17499999999999996 -0.48125000000000007 -0.7000000000000001 -0.8312499999999999 -0.875 -0.8312499999999999 -0.7000000000000001 -0.48125000000000007 -0.17499999999999996 0.21875])): Legend surfacedata parameterygrid::Bool=false: Show y-axis grid (true/false)layout_grid_colgap::Int64=10: Gap between columns (in pixels)legend_linecolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend linecolorrange parameterlegend_heatmaplimits::Observables.Observable{Any}=Observable{Any}((0 .. 1, 0 .. 1)): Legend heatmaplimits parameterlegend_meshscatterrotation::Observables.Observable{Any}=Observable{Any}(1.0 + 0.0im + 0.0jm + 0.0km): Legend meshscatterrotation parameterlegend_heatmapvalues::Observables.Observable{Any}=Observable{Any}([0.0 0.3; 0.6 1.0]): Legend heatmapvalues parameterlegend_tellheight::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend tellheight parametercolor::Symbol=black: Color for ERPs (single color or a vector of colors, one per dataset)legend_margin::Observables.Observable{Any}=Observable{Any}((6, 6, 6, 6)): Legend margin parameterlegend_polypoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]): Legend polypoints parameterlegend_channel::Vector{Any}=Any[]: Which channel to put the legend on.legend_imagevalues::Observables.Observable{Any}=Observable{Any}([0.0 0.3; 0.6 1.0]): Legend imagevalues parameterlayout_grid_rowgap::Int64=10: Gap between rows (in pixels)legend_labelfont::Observables.Observable{Any}=Observable{Any}(:regular): Legend labelfont parameterlegend_orientation::Observables.Observable{Any}=Observable{Any}(:vertical): Legend orientation parameterlinewidth::Int64=2: Line width for ERPslayout_topo_scale_offset::Float64=0.1: Offset factor for scale plot positionlegend_polycolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.4, 0.4, 0.4)): Legend polycolor parameterlegend_linepoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.0, 0.5], [1.0, 0.5]]): Legend linepoints parameterlayout_grid_dims::Nothing=nothing: Grid dimensions as (rows, cols) tuple for grid layouts. If nothing, automatically determinedlegend_surfacecolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend surfacecolormap parameterlegend_alignmode::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Inside()): Legend alignmode parametercolormap::Symbol=jet: Colormap for multi-channel plotsyminorgrid::Bool=false: Show y-axis minor grid (true/false)time_unit::Symbol=s: Time unit for x-axis display (😒 or :ms). Only affects axis labels and tick formatting — all intervals remain in seconds.legend_heatmapcolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend heatmapcolorrange parameterlegend_meshcolor::Observables.Observable{Any}=Observable{Any}(RGBA{Float32}(0.0, 0.44705883, 0.69803923, 1.0)): Legend meshcolor parameterlegend_label::String=: Title for the legendlegend_titlesize::Observables.Observable{Any}=Observable{Any}(14): Legend titlesize parameterlegend_patchcolor::Observables.Observable{Any}=Observable{Any}(:transparent): Legend patchcolor parameterylabel::String=μV: Label for y-axislegend_framevisible::Bool=true: Legend frame visible (true/false)legend_polycolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend polycolorrange parameterlegend_groupgap::Observables.Observable{Any}=Observable{Any}(16): Legend groupgap parameterdisplay_plot::Bool=true: Display the plot (true/false)interactive::Bool=true: Enable interactive features (true/false)average_channels::Bool=false: Average across channels (true/false)legend_meshcolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend meshcolorrange parameterlegend_labelcolor::Observables.Observable{Any}=Observable{Any}(:black): Legend labelcolor parameterlegend::Bool=true: Show the legend (true/false)xlabel::String=Time (s): Label for x-axislegend_polystrokecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend polystrokecolor parameterlegend_linestyle::Observables.Observable{Any}=Observable{Any}(:solid): Legend linestyle parameterlegend_meshscattermarker::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Sphere{Float32}(Float32[0.0, 0.0, 0.0], 1.0f0)): Legend meshscattermarker parameterlegend_mesh::Observables.Observable{Any}=Observable{Any}(GeometryBasics.HyperRectangle{3, Float32}(Float32[-0.7, -0.7, -0.7], Float32[1.4, 1.4, 1.4])): Legend mesh parameterlegend_linecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend linecolor parameterlegend_meshcolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend meshcolormap parameterhighlight_regions::Nothing=nothing: Highlight regions as a NamedTuple or Vector of NamedTuples. Each region: (x1, x2, y1=-Inf, y2=Inf, color=:gray, alpha=0.3)legend_meshscatterpoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{3, Float32}[[0.0, 0.0, 0.0]]): Legend meshscatterpoints parameterlegend_nbanks::Nothing=nothing: Number of legend columns.add_xy_origin::Bool=true: Add origin lines at x=0 and y=0 (true/false)legend_labelhalign::Observables.Observable{Any}=Observable{Any}(:left): Legend labelhalign parameterlegend_polycolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend polycolormap parameterlegend_rowgap::Observables.Observable{Any}=Observable{Any}(3): Legend rowgap parameterlegend_gridsvalign::Observables.Observable{Any}=Observable{Any}(:center): Legend gridsvalign parameterlegend_valign::Observables.Observable{Any}=Observable{Any}(:top): Legend valign parameterlegend_surfacevalues::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend surfacevalues parameterlayout_topo_scale_pos::Tuple{Float64, Float64}=(0.8, -0.8): Fallback position for scale plot in topo layout as (x, y) tuplelegend_markerstrokewidth::Observables.Observable{Any}=Observable{Any}(0): Legend markerstrokewidth parameterlegend_marker::Observables.Observable{Any}=Observable{Any}(:circle): Legend marker parameterlegend_meshscattercolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend meshscattercolormap parameterlegend_polystrokewidth::Observables.Observable{Any}=Observable{Any}(0): Legend polystrokewidth parameterlegend_labeljustification::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend labeljustification parameterfigure_padding::NTuple{4, Int64}=(10, 10, 10, 10): Padding around entire figure as (left, right, top, bottom) tuple (in pixels)legend_tellwidth::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend tellwidth parameterlegend_patchlabelgap::Observables.Observable{Any}=Observable{Any}(5): Legend patchlabelgap parameterlegend_markersize::Observables.Observable{Any}=Observable{Any}(9): Legend markersize parameterlegend_width::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Legend width parameterlegend_titlecolor::Observables.Observable{Any}=Observable{Any}(:black): Legend titlecolor parameterlegend_imagelimits::Observables.Observable{Any}=Observable{Any}((0 .. 1, 0 .. 1)): Legend imagelimits parameterlegend_linecolormap::Observables.Observable{Any}=Observable{Any}(:viridis): Legend linecolormap parameterlegend_padding::Observables.Observable{Any}=Observable{Any}((6.0f0, 6.0f0, 6.0f0, 6.0f0)): Legend padding parameterlegend_meshscattercolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend meshscattercolorrange parameterlegend_markercolorrange::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Legend markercolorrange parameterlegend_gridshalign::Observables.Observable{Any}=Observable{Any}(:center): Legend gridshalign parameterlegend_titlevisible::Observables.Observable{Any}=Observable{Any}(true): Legend titlevisible parameterlegend_titlegap::Observables.Observable{Any}=Observable{Any}(8): Legend titlegap parameterlegend_markerpoints::Observables.Observable{Any}=Observable{Any}(GeometryBasics.Point{2, Float32}[[0.5, 0.5]]): Legend markerpoints parameteryticks::Nothing=nothing: Y-axis tick positions (e.g., -4:2:4 or [-2, 0, 2]). If nothing, automatically determinedlegend_titlefont::Observables.Observable{Any}=Observable{Any}(:bold): Legend titlefont parameter
Returns
- Named tuple
(fig, axes)
Examples
# With analytic test results - single channel
result = analytic_test(prepared, correction_method=:no)
plot_erp_stats(result, channel_selection=channels(:PO7),
plot_erp=true, plot_difference=true, plot_significance=true)
# Grid layout with multiple channels
plot_erp_stats(result, channel_selection=channels([:PO7, :PO8, :Oz, :Pz]),
layout=:grid, plot_significance=true)
# With permutation test results
result_perm = permutation_test(prepared, n_permutations=1000)
plot_erp_stats(result_perm, channel_selection=channels(:PO7),
plot_erp=true, plot_significance=true, plot_critical_t=true)EegFun.plot_filter_response Method
plot_filter_response(filter_info::FilterInfo; kwargs...)Plot the frequency response and impulse response of a digital filter.
Arguments
filter_info::FilterInfo: Filter information structkwargs...: Additional keyword arguments
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
display_plot::Bool=true: Whether to display the plotygrid::Bool=false: Whether to show y-axis gridxlim::Nothing=nothing: X-axis limits in Hz as (min, max) tuple. If nothing, automatically determinedreference_color::Symbol=gray: Color for reference linesyminorgrid::Bool=false: Whether to show y-axis minor gridylim::Tuple{Int64, Int64}=(-100, 5): Y-axis limits in dB as (min, max) tuplexlabel::String=Frequency (Hz): X-axis labeln_points::Int64=2000: Number of frequency points for response calculationxminorgrid::Bool=false: Whether to show x-axis minor gridxscale::Makie.ReversibleScale{Makie.var"#forward#1107"{Int64, Float64, Float64}, Makie.var"#inverse#1108"{Int64, Float64, Float64}, IntervalSets.OpenInterval{Float32}}=ReversibleScale(Symlog10): X-axis scale typecolor::Symbol=blue: Color for response curvesreference_lines::Vector{Int64}=[-3, -6]: Reference lines in dB to displaylabel_fontsize::Int64=22: Font size for axis labelsylabel::String=Magnitude (dB): Y-axis labelxgrid::Bool=false: Whether to show x-axis gridreference_linestyle::Symbol=dash: Line style for reference linestitle::String=Filter Frequency Response: Plot titlelinewidth::Int64=4: Line width for response curvestitle_fontsize::Int64=24: Font size for titletick_fontsize::Int64=20: Font size for tick labels
Returns
fig: Makie Figure objectax: Tuple of Makie Axis objects (dB, impulse)
EegFun.plot_frequency_spectrum Method
plot_frequency_spectrum(spectrum_data::SpectrumData;
channel_selection::Function=channels(),
x_scale::Symbol=:linear,
y_scale::Symbol=:linear,
unit::Symbol=:linear,
max_freq::Union{Nothing,Real}=nothing,
colormap=:default,
title::Union{Nothing,String}=nothing,
show_legend::Bool=true,
linewidth::Real=2,
line_alpha::Real=0.8)Plot power spectrum data for selected channels.
Arguments
spectrum_data::SpectrumData: Power spectrum data
Keyword Arguments
channel_selection::Function=channels(): Channel selection predicate. Seechannels()for options.Example:
channel_selection=channels(:Cz)for single channelExample:
channel_selection=channels([:Cz, :Pz])for multiple channels
x_scale::Symbol=:linear: X-axis scale (:linearor:log10)y_scale::Symbol=:linear: Y-axis scale (:linearor:log10)unit::Symbol=:linear: Power unit (:linearfor μV²/Hz or:dBfor decibels)max_freq::Union{Nothing,Real}=nothing: Maximum frequency to display in Hz. Ifnothing, uses all frequencies.colormap: Colormap for lines (default: automatic colors)title::Union{Nothing,String}=nothing: Plot title (default: auto-generated)show_legend::Bool=true: Show legend with channel nameslinewidth::Real=2: Line width for spectrum linesline_alpha::Real=0.8: Transparency for spectrum lines
Returns
(Figure, Axis): Makie figure and axis
Example
# Plot all channels
fig, ax = plot_frequency_spectrum(spectrum_data)
# Single channel with log scales
fig, ax = plot_frequency_spectrum(spectrum_data;
channel_selection=channels(:Cz),
x_scale=:log10,
y_scale=:log10)
# With dB units
fig, ax = plot_frequency_spectrum(spectrum_data; unit=:dB, max_freq=100.0)EegFun.plot_gfp Method
plot_gfp(dat::ErpData;
channel_selection::Function = channels(),
normalize::Bool = true,
kwargs...)Plot Global Field Power (GFP) for ERP data.
Arguments
dat::ErpData: ERP data structurechannel_selection::Function: Channel predicate for selecting channels (default: all channels)normalize::Bool: If true, normalize GFP to 0-100% (default: true)kwargs: Additional keyword arguments
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
display_plot::Bool=true: Whether to display the plotygrid::Bool=false: Whether to show y-axis gridxlim::Nothing=nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedyminorgrid::Bool=false: Whether to show y-axis minor gridshow_erp_traces::Bool=false: Whether to show individual ERP channel traces in top panelylim::Nothing=nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedxlabel::String=Time (s): Label for x-axisxminorgrid::Bool=false: Whether to show x-axis minor gridcolor::Symbol=black: Color for tracesylabel::Nothing=nothing: Label for y-axis (auto-determined based on normalize flag)linestyle::Symbol=solid: Line style for tracesshow_title::Bool=true: Whether to show the titlexgrid::Bool=false: Whether to show x-axis gridtitle::String=: Plot titleshow_dissimilarity::Bool=false: Whether to include Global Dissimilarity panellinewidth::Int64=2: Line width for GFP/dissimilarity tracesadd_x_origin::Bool=true: Whether to add vertical line at x=0
Examples
using EegFun, JLD2
# Load and plot GFP
erp_data = load("participant_1_erps.jld2", "erps")[1]
plot_gfp(erp_data)
# Plot with individual channel traces
plot_gfp(erp_data, show_erp_traces = true)
# Plot with Global Dissimilarity
plot_gfp(erp_data, show_dissimilarity = true)
# Plot all three panels
plot_gfp(erp_data, show_erp_traces = true, show_dissimilarity = true)
# Custom styling
plot_gfp(erp_data,
color = :blue,
linewidth = 3,
xlim = (-0.2, 0.8))Plot Layout
By default, shows only the GFP trace. With show_erp_traces=true, adds a top panel with all channel traces. With show_dissimilarity=true, adds a bottom panel with Global Dissimilarity.
plot_gfp(filepath::String; input_dir=pwd(), participant_selection=participants(), kwargs...)Load ERP data and plot GFP. Accepts either a .jld2 filepath or a pattern to discover and plot all matching files (one plot per file).
Examples
plot_gfp("erps_good.jld2")
plot_gfp("erps_good")EegFun.plot_gui Method
plot_gui()Interactive GUI for quick data plotting and visualization.
GUI Structure
Column 1: File & Plot Selection
Directory and file browser
Plot type dropdown with hierarchical submenus:
Common plots: Data Browser, Epochs, ERP, ERP Image, Topography
Time-Frequency >: Time-Frequency, Power Spectrum
ICA > : Components, Activation
ERP Analysis > : ERP GUI
Diagnostic Plots >: Artifact Detection, Triggers, Channel Summary, Joint Probability, Correlation Heatmap, Global Field Power, Layout View, Filter Response
Column 2: Data Selection & Layout
Participant, Condition, Epoch filters (integers, space/comma-separated)
Layout type: Single, Single Avg, Grid, Topo
Channel selection with multi-select support
Column 3: Axis Settings
X, Y, Z axis limits (validated numeric input with range checking)
Baseline correction window and type
Display options (invert Y-axis)
Supported Plot Types
See EegFun.jl documentation for complete plot type details and data requirements.
Examples
# Launch GUI
EegFun.plot_gui()
# Navigate to data directory, select file and plot type
# Configure channels and axis limits as needed
# Click "Plot" to generate visualizationEegFun.plot_ica_component_activation Method
plot_ica_component_activation(dat::ContinuousData, ica::InfoIca; ...)Interactive Viewer for ICA Component Activation
Arguments
dat::ContinuousData: Continuous EEG data object.ica::InfoIca: ICA results object.
Keyword Arguments
artifacts::Union{Nothing,ArtifactComponents}=nothing: Optional artifact detection results. When provided, adds category checkboxes for filtering components.component_selection::Function=components(:all): Predicate to select which components to display.n_visible_components::Int=10: Number of components visible at once (auto-adjusted for selected components).window_size::Int=2000: Initial time window size in samples.topo_kwargs::Dict=Dict(): Keyword arguments passed down for topography plots (see_plot_topo_on_axis!).head_kwargs::Dict=Dict(): Keyword arguments passed down for head outlines.point_kwargs::Dict=Dict(): Keyword arguments passed down for channel markers.label_kwargs::Dict=Dict(): Keyword arguments passed down for channel labels.
Returns
fig::Figure: The Makie Figure object containing the interactive plot.
EegFun.plot_joint_probability! Method
plot_joint_probability!(fig::Figure, ax::Axis, dat::DataFrame; kwargs...)Plot a bar chart of joint probability values per channel on the provided figure and axis.
This is the mutating version that plots directly on the provided fig and ax objects.
Assumes the DataFrame dat contains at least two columns:
:channel: Containing channel names or identifiers (will be used for x-axis labels).:jp: Containing the joint probability values to plot.
Arguments
fig::Figure: The Makie Figure object to plot onax::Axis: The Makie Axis object to plot ondat::DataFrame: DataFrame with channel and joint probability data.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
sort_values::Bool=false: If true, sort the bars by joint probability values in descending orderdisplay_plot::Bool=true: Whether to display the plotygrid::Bool=true: Whether to show y-axis gridbar_width::Float64=0.8: Width of barsbar_alpha::Float64=0.7: Transparency of barsyminorgrid::Bool=false: Whether to show y-axis minor gridxlabel::String=Electrode: Label for x-axisxminorgrid::Bool=false: Whether to show x-axis minor gridlabel_fontsize::Int64=14: Font size for axis labelsylabel::String=Joint Probability: Label for y-axisxgrid::Bool=true: Whether to show x-axis gridtitle::String=: Plot titlebar_color::Symbol=steelblue: Color of the barsxtick_rotation::Float64=0.7853981633974483: Rotation angle for x-axis tick labelstitle_fontsize::Int64=16: Font size for titletick_fontsize::Int64=12: Font size for tick labels
Returns
nothing(modifies the provided figure and axis in-place)
Example
# Basic usage
fig = Figure()
ax = Axis(fig[1, 1])
plot_joint_probability!(fig, ax, jp_df)
# Custom styling
plot_joint_probability!(fig, ax, jp_df;
title = "Custom Joint Probability",
bar_color = :orange,
sort_values = true)EegFun.plot_joint_probability Method
plot_joint_probability(dat::DataFrame; kwargs...)Plot a bar chart of joint probability values per channel.
Assumes the DataFrame dat contains at least two columns:
:channel: Containing channel names or identifiers (will be used for x-axis labels).:jp: Containing the joint probability values to plot.
Arguments
dat::DataFrame: DataFrame with channel and joint probability data.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
sort_values::Bool=false: If true, sort the bars by joint probability values in descending orderdisplay_plot::Bool=true: Whether to display the plotygrid::Bool=true: Whether to show y-axis gridbar_width::Float64=0.8: Width of barsbar_alpha::Float64=0.7: Transparency of barsyminorgrid::Bool=false: Whether to show y-axis minor gridxlabel::String=Electrode: Label for x-axisxminorgrid::Bool=false: Whether to show x-axis minor gridlabel_fontsize::Int64=14: Font size for axis labelsylabel::String=Joint Probability: Label for y-axisxgrid::Bool=true: Whether to show x-axis gridtitle::String=: Plot titlebar_color::Symbol=steelblue: Color of the barsxtick_rotation::Float64=0.7853981633974483: Rotation angle for x-axis tick labelstitle_fontsize::Int64=16: Font size for titletick_fontsize::Int64=12: Font size for tick labels
Returns
Figure: The Makie Figure object.Axis: The Makie Axis object for the bar plot.
Example
# Basic usage
fig, ax = plot_joint_probability(jp_df)
# Custom styling
fig, ax = plot_joint_probability(jp_df;
title = "Joint Probability Analysis",
bar_color = :red,
sort_values = true,
grid_visible = false)EegFun.plot_layout_2d! Method
plot_layout_2d!(fig::Figure, ax::Axis, layout::Layout; neighbours::Bool=false, correlation_matrix::Union{DataFrame, Nothing}=nothing, kwargs...)Plot a 2D EEG electrode layout with customizable head shape, electrode points, and labels.
Arguments
fig: The figure to plot onax: The axis to plot onlayout: Layout containing electrode positions with columns x2, y2, and labelneighbours: Boolean to show interactive neighbour connections (default: false). Ignored ifcorrelation_matrixis provided.correlation_matrix: Optional DataFrame fromcorrelation_matrix()to show correlation values on hover (default: nothing). When provided,neighboursis ignored.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
head_linewidth::Int64=2: Line width of the head shape outline.head_radius::Int64=1: Radius of the head shape (normalized units).head_color::Symbol=black: Color of the head shape outline.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.point_markersize::Int64=12: Size of electrode point markers.point_color::Symbol=black: Color of electrode points.point_marker::Symbol=circle: Marker style for electrode points.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
label_plot::Bool=true: Whether to plot electrode labels.label_fontsize::Int64=20: Font size for electrode labels.label_xoffset::Int64=0: X-axis offset for electrode labels.label_zoffset::Int64=0: Z-axis offset for electrode labels (3D only).label_yoffset::Int64=0: Y-axis offset for electrode labels.label_color::Symbol=black: Color of electrode labels.
Returns
nothing(modifies the provided figure and axis in-place)
Example
layout = Layout("biosemi64.csv")
polar_to_cartesian_xy!(layout)
fig = Figure()
ax = Axis(fig[1, 1])
plot_layout_2d!(fig, ax, layout)
# With correlation matrix
cm = correlation_matrix(dat)
plot_layout_2d!(fig, ax, layout, correlation_matrix=cm)EegFun.plot_layout_2d Method
plot_layout_2d(layout::Layout; neighbours::Bool=false, correlation_matrix::Union{DataFrame, Nothing}=nothing, display_plot::Bool=true, kwargs...)Create a new figure and plot a 2D EEG electrode layout.
Arguments
layout: Layout containing electrode positionsneighbours: Boolean to show interactive neighbour connections (default: false). Ignored ifcorrelation_matrixis provided.correlation_matrix: Optional DataFrame fromcorrelation_matrix()to show correlation values on hover (default: nothing). When provided,neighboursis ignored.display_plot: Boolean to display the plot (default: true)
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
head_linewidth::Int64=2: Line width of the head shape outline.head_radius::Int64=1: Radius of the head shape (normalized units).head_color::Symbol=black: Color of the head shape outline.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.point_markersize::Int64=12: Size of electrode point markers.point_color::Symbol=black: Color of electrode points.point_marker::Symbol=circle: Marker style for electrode points.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
label_plot::Bool=true: Whether to plot electrode labels.label_fontsize::Int64=20: Font size for electrode labels.label_xoffset::Int64=0: X-axis offset for electrode labels.label_zoffset::Int64=0: Z-axis offset for electrode labels (3D only).label_yoffset::Int64=0: Y-axis offset for electrode labels.label_color::Symbol=black: Color of electrode labels.
Returns
- The figure and axis objects
Example
layout = read_layout("./layouts/biosemi64.csv")
polar_to_cartesian_xy!(layout)
plot_layout_2d(layout)
# With neighbour interactivity
plot_layout_2d(layout, neighbours=true)
# With correlation matrix
cm = correlation_matrix(dat)
plot_layout_2d(layout, correlation_matrix=cm)EegFun.plot_layout_3d! Method
plot_layout_3d!(fig::Figure, ax::Axis3, layout::Layout; neighbours::Bool=false, kwargs...)Plot a 3D EEG electrode layout with customizable head shape, electrode points, and labels.
Arguments
fig: The figure to plot onax: The axis to plot onlayout: Layout containing electrode positions with columns x3, y3, z3, and labelneighbours: Boolean to show interactive neighbour connections (default: false)
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
head_linewidth::Int64=2: Line width of the head shape outline.head_radius::Int64=1: Radius of the head shape (normalized units).head_color::Symbol=black: Color of the head shape outline.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.point_markersize::Int64=12: Size of electrode point markers.point_color::Symbol=black: Color of electrode points.point_marker::Symbol=circle: Marker style for electrode points.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
label_plot::Bool=true: Whether to plot electrode labels.label_fontsize::Int64=20: Font size for electrode labels.label_xoffset::Int64=0: X-axis offset for electrode labels.label_zoffset::Int64=0: Z-axis offset for electrode labels (3D only).label_yoffset::Int64=0: Y-axis offset for electrode labels.label_color::Symbol=black: Color of electrode labels.
Returns
nothing(modifies the provided figure and axis in-place)
Example
layout = Layout("biosemi64.csv")
polar_to_cartesian_xyz!(layout)
fig = Figure()
ax = Axis3(fig[1, 1])
plot_layout_3d!(fig, ax, layout)EegFun.plot_layout_3d Method
plot_layout_3d(layout::Layout; neighbours::Bool=false, display_plot::Bool=true, kwargs...)Create a new figure and plot a 3D EEG electrode layout.
Arguments
layout: Layout containing electrode positionsneighbours: Boolean to show interactive neighbour connections (default: false)display_plot: Boolean to display the plot (default: true)
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
head_linewidth::Int64=2: Line width of the head shape outline.head_radius::Int64=1: Radius of the head shape (normalized units).head_color::Symbol=black: Color of the head shape outline.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.point_markersize::Int64=12: Size of electrode point markers.point_color::Symbol=black: Color of electrode points.point_marker::Symbol=circle: Marker style for electrode points.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
label_plot::Bool=true: Whether to plot electrode labels.label_fontsize::Int64=20: Font size for electrode labels.label_xoffset::Int64=0: X-axis offset for electrode labels.label_zoffset::Int64=0: Z-axis offset for electrode labels (3D only).label_yoffset::Int64=0: Y-axis offset for electrode labels.label_color::Symbol=black: Color of electrode labels.
Returns
- The figure and axis objects
Example
layout = read_layout("./layouts/biosemi64.csv")
polar_to_cartesian_xyz!(layout)
plot_layout_3d(layout)
# With neighbour interactivity
plot_layout_3d(layout, neighbours=true)EegFun.plot_line_noise_components Method
plot_line_noise_components(line_noise_comps::Vector{Int}, metrics_df::DataFrame; kwargs...)Plot spectral metrics used for line noise component identification.
Arguments
line_noise_comps::Vector{Int}: Vector of component indices identified as line noise.metrics_df::DataFrame: DataFrame containing line noise metrics. Expected to have columns:Component,:power_ratio_zscore, and:harmonic_ratio.
Keyword Arguments
z_threshold::Float64: Z-score threshold for the reference line (default: 3.0).min_harmonic_power::Real: Minimum harmonic power reference line (default: 0.5).display_plot::Bool: Whether to display the plot (default: true).
Returns
- Named tuple
(fig, axes)whereaxes = (ax1, ax2).
EegFun.plot_model_correlations Method
plot_model_correlations(rsa_data::RsaData; kwargs...)Plot model correlations over time.
Arguments
rsa_data::RsaData: RSA results with model comparisonskwargs: Additional keyword arguments
Examples
# Plot correlations with models
plot_model_correlations(rsa_result)
# Custom styling
plot_model_correlations(rsa_result, colors=[:red, :blue], title="Model Comparison")EegFun.plot_rdm_heatmap Method
plot_rdm_heatmap(rsa_data::RsaData; time_point::Union{Float64, Int, Nothing} = nothing, kwargs...)Plot Representational Dissimilarity Matrix (RDM) as a heatmap.
Shows a matrix visualization of pairwise dissimilarities between conditions at a specific time point or averaged across time.
Arguments
rsa_data::RsaData: RSA resultstime_point::Union{Float64, Int, Nothing}: Time point to plot (Float64 = time in seconds, Int = index, nothing = average across time)kwargs: Additional keyword arguments
Examples
# Plot RDM at a specific time point
plot_rdm_heatmap(rsa_result, time_point=0.3)
# Plot average RDM across all time points
plot_rdm_heatmap(rsa_result)
# Plot RDM at time index 50
plot_rdm_heatmap(rsa_result, time_point=50)EegFun.plot_rdm_timecourse Method
plot_rdm_timecourse(
rsa_data::RsaData;
condition_pairs::Union{Vector{Tuple{Int,Int}}, Symbol, Nothing} = :all,
kwargs...
)Plot dissimilarity timecourse for condition pairs.
Shows how dissimilarity between conditions evolves over time as lines. This helps visualize when conditions become distinguishable.
Arguments
rsa_data::RsaData: RSA resultscondition_pairs: Which condition pairs to plot:all- All pairwise comparisons (default):upper- Upper triangle only (same as :all, no duplicates)Vector{Tuple{Int,Int}}- Specific pairs, e.g.,[(1,2), (1,3)]
kwargs: Additional keyword arguments
Examples
# Plot all condition pairs
plot_rdm_timecourse(rsa_result)
# Plot only specific pairs
plot_rdm_timecourse(rsa_result, condition_pairs=[(1,2), (1,3)])
# Custom styling
plot_rdm_timecourse(rsa_result, title="Dissimilarity Over Time")EegFun.plot_rsa Method
plot_rsa(rsa_data::RsaData; kwargs...)Main plotting function for RSA results.
If model correlations are available, plots them. Otherwise, plots RDM heatmap at average time.
Arguments
rsa_data::RsaData: RSA resultskwargs: Additional keyword arguments (passed to plot_model_correlations or plot_rdm_heatmap)
Examples
# Plot RSA results (automatically chooses best visualization)
plot_rsa(rsa_result)
# Force RDM heatmap plot
plot_rsa(rsa_result, plot_type=:rdm, time_point=0.3)plot_rsa(filepath::String; input_dir=pwd(), participant_selection=participants(), kwargs...)Load RSA data and plot. Accepts either a .jld2 filepath or a pattern to discover and plot all matching files (one plot per file).
Examples
plot_rsa("rsa_results.jld2")
plot_rsa("rsa_results")EegFun.plot_spatial_kurtosis_components Method
plot_spatial_kurtosis_components(kurtosis_comps::Vector{Int}, metrics_df::DataFrame; kwargs...)Plot spatial kurtosis z-scores for all ICA components and highlight those exceeding the threshold.
Arguments
kurtosis_comps::Vector{Int}: Vector of component indices identified as having high spatial kurtosis.metrics_df::DataFrame: DataFrame containing spatial kurtosis metrics. Expected to have columns:Componentand:z_spatial_kurtosis.
Keyword Arguments
z_threshold::Float64: Z-score threshold for the reference line (default: 3.0).display_plot::Bool: Whether to display the plot (default: true).
Returns
- Named tuple
(fig, axis).
EegFun.plot_tf Method
plot_tf(filepath::String; kwargs...)
plot_tf(tf::TimeFreqData; channel_selection, baseline_interval, kwargs...)
plot_tf(tfs::Vector{TimeFreqData}; channel_selection, baseline_interval, kwargs...)Plot time-frequency data as a heatmap (time × frequency). Supports single condition, multi-condition grid, and topographic layouts.
Arguments
filepath::String: Path to a.jld2file, or aTimeFreqData/Vector{TimeFreqData}objectchannel_selection::Function: Channel filter (default: all channels)baseline_interval: Baseline window as(start, stop)in seconds (default:nothing)
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
layout_grid_dims::Nothing=nothing: Grid dimensions as (rows, cols) tuple. If nothing, automatically determinedcolorbar::Bool=true: Whether to show a colorbardisplay_plot::Bool=true: Whether to display the plotinterpolate::Bool=false: Whether to interpolate the heatmap for a smoother appearancexlim::Nothing=nothing: X-axis time limits as (min, max) tuple in seconds. If nothing, shows all time pointscolormap::Symbol=viridis: Colormap for the heatmaplayout_grid_colgap::Int64=10: Gap between columns in grid layout (pixels)layout_topo_plot_height::Float64=0.1: Height of individual plots in topo layout (fraction of figure height)layout::Symbol=single: Layout type: :single, :grid, or :topocolorrange::Nothing=nothing: Color range as (min, max) tuple. If nothing, automatically determined from dataylogscale::Bool=false: Whether to use logarithmic scale for the frequency (y) axislayout_grid_rowgap::Int64=10: Gap between rows in grid layout (pixels)title::Nothing=nothing: Plot title. If nothing, automatically determined from condition name and channelbaseline_method::Symbol=db: Baseline correction method: :db, :absolute, :relative, :relchange, :percent, :zscorelayout_topo_plot_width::Float64=0.1: Width of individual plots in topo layout (fraction of figure width)
Examples
plot_tf("tf_morlet_result.jld2")
plot_tf("tf_morlet_result.jld2"; layout=:grid, channel_selection=channels([:Cz, :Pz]))
plot_tf(tf; colormap=:RdBu, ylogscale=true, baseline_interval=(-0.3, 0.0))EegFun.plot_tf_stats Method
plot_tf_stats(result::TFStatsResult;
channel_selection::Function = channels(),
channel_plot_order::Union{Nothing, Vector{Symbol}} = nothing,
content::Symbol = :tvalues,
significance::Symbol = :contour,
colormap = :RdBu,
colorrange = nothing,
ylogscale::Bool = false,
colorbar::Bool = true,
significance_color = :black,
significance_linewidth::Real = 2.0,
stipple_alpha::Real = 0.4,
opacity_alpha::Real = 0.3,
figure_size = nothing,
display_plot::Bool = true)Plot TF statistical results as heatmaps with significance overlays.
Works with both TFClusterPermutationResult (from permutation_test) and TFAnalyticResult (from analytic_test).
Arguments
result::TFStatsResult: Statistical result to plotchannel_selection::Function: Channel selection predicate (default: all channels)content::Symbol: What to plot as the heatmap::tvalues(default) - t-statistic values:difference- power difference (condition A - B):power_a- grand average power for condition A:power_b- grand average power for condition B
significance::Symbol: How to visualize significant regions::contour(default) - black contour lines around significant regions:stipple- semi-transparent dots over non-significant regions:opacity- dim non-significant regions:none- no significance overlay
colormap: Colormap (default::RdBu)colorrange: Color range tuple ornothingfor auto (auto-symmetric for t-values)ylogscale::Bool: Log scale for frequencies (default: false)colorbar::Bool: Show colorbar (default: true)significance_color: Color for contour lines (default::black)significance_linewidth::Real: Width of contour lines (default: 2.0)stipple_alpha::Real: Alpha for stipple dots (default: 0.4)opacity_alpha::Real: Alpha for dimming non-significant regions (default: 0.3)figure_size: Figure size tuple ornothingfor autodisplay_plot::Bool: Display the plot (default: true)
Returns
Named tuple (fig, axes) with Makie Figure and vector of Axes.
Examples
# Basic t-value heatmap with contour significance
result = permutation_test(prepared; n_permutations=1000, cluster_type=:temporal)
plot_tf_stats(result, channel_selection=channels(:Cz))
# Power difference with stipple overlay
plot_tf_stats(result, content=:difference, significance=:stipple)
# Multiple channels in grid
plot_tf_stats(result, channel_selection=channels([:Cz, :Fz, :Pz, :Oz]))
# With analytic test results
result_analytic = analytic_test(prepared)
plot_tf_stats(result_analytic, significance=:opacity, colormap=:viridis)EegFun.plot_topography! Method
In-place topographic plot for a specific epoch of multi-epoch data.
sourceEegFun.plot_topography! Method
In-place topographic plot: subset data and render onto an existing figure/axis.
sourceEegFun.plot_topography Method
plot_topography(ica::InfoIca; ...)Plot multiple ICA component topographies in a grid layout within a new Figure.
Arguments
ica::InfoIca: The ICA result object (contains layout information).
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.colorbar_nsteps::Observables.Observable{Any}=Observable{Any}(100): Colorbar nsteps parametercolorbar_leftspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar leftspinevisible parametercolorbar_limits::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar limits parameterpoint_markersize::Int64=12: Size of electrode point markers.colorbar_size::Observables.Observable{Any}=Observable{Any}(12): Colorbar size parametercolorbar_alignmode::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Inside()): Colorbar alignmode parametercolorbar_topspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar topspinecolor parametercolorbar_plot_numbers::Vector{Any}=Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_ticksize::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar ticksize parametercolorbar_minortickcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar minortickcolor parametercolorbar_halign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar halign parametercolorbar_ticksvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticksvisible parametercolorbar_tellheight::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellheight parametercolorbar_vertical::Observables.Observable{Any}=Observable{Any}(true): Colorbar vertical parametercolorbar_ticklabelspace::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelspace parametercolorbar_ticklabelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar ticklabelfont parametercolorbar_minortickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar minortickwidth parametercolorbar_width::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar width parametercolorbar_leftspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar leftspinecolor parametershow_title::Bool=true: Whether to show the titlecolorbar_colorrange::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar colorrange parametercolorbar_plot::Bool=true: Whether to display the colorbarcolorbar_labelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar labelcolor parameternum_levels::Int64=20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.gridscale::Int64=75: Grid resolution for interpolationylim::Nothing=nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.method::Symbol=thin_plate: Interpolation method: :multiquadratic, :inverse_multiquadratic, :gaussian, :inverse_quadratic, :thin_plate, :polyharmonic, :shepard, :nearest, :spherical_spline. See https://eljungsk.github.io/ScatteredInterpolation.jl/dev/methods/ for details on methods.colorbar_minorticksvisible::Observables.Observable{Any}=Observable{Any}(false): Colorbar minorticksvisible parametercolorbar_valign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar valign parameterfigure_title::String=Topography Plot: Title for the plot windowtitle::String=: Plot titlecolorbar_label::String=μV: Label for the colorbarlabel_xoffset::Int64=0: X-axis offset for electrode labels.colorbar_colormap::Observables.Observable{Any}=Observable{Any}(:viridis): Colorbar colormap parametercolorbar_flip_vertical_label::Observables.Observable{Any}=Observable{Any}(false): Colorbar flip_vertical_label parameterpoint_color::Symbol=black: Color of electrode points.colorbar_lowclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar lowclip parametercolorbar_scale::Observables.Observable{Any}=Observable{Any}(identity): Colorbar scale parametercolorbar_flipaxis::Observables.Observable{Any}=Observable{Any}(true): Colorbar flipaxis parametercolorbar_tellwidth::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellwidth parametercolorbar_position::Tuple{Int64, Int64}=(1, 2): Colorbar position as (row, col) tuple, or :right, :belowcolorbar_labelvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar labelvisible parameterdims::Nothing=nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish gridcolormap::Symbol=jet: Colormap for the topographytime_unit::Symbol=s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.colorbar_ticklabelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar ticklabelsize parametercolorbar_rightspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar rightspinecolor parametercolorbar_labelpadding::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar labelpadding parametercolorbar_spinewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar spinewidth parametercolorbar_bottomspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar bottomspinevisible parametercomponent_selection::EegFun.var"#components##0#components##1"=#components##0: Function that returns boolean vector for component filteringcolorbar_ticklabelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar ticklabelcolor parameteruse_global_scale::Bool=false: Do multiple ICA topoplots share the same color scale based on min/max across all components?point_marker::Symbol=circle: Marker style for electrode points.label_plot::Bool=true: Whether to plot electrode labels.colorbar_tickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar tickwidth parameterdisplay_plot::Bool=true: Whether to display the plotinteractive::Bool=true: Whether to enable interactive featurescolorbar_tickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar tickalign parametercolorbar_ticklabelpad::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar ticklabelpad parameterlabel_yoffset::Int64=0: Y-axis offset for electrode labels.colorbar_labelrotation::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar labelrotation parametercolorbar_ticklabelsvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticklabelsvisible parameterhead_linewidth::Int64=2: Line width of the head shape outline.head_radius::Float64=1.0: Radius of the head shape in mm.title_fontsize::Int64=16: Font size for the titlecolorbar_topspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar topspinevisible parameterhead_color::Symbol=black: Color of the head shape outline.colorbar_minorticksize::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar minorticksize parametercolorbar_tickformat::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar tickformat parameterlabel_fontsize::Int64=20: Font size for electrode labels.colorbar_ticklabelrotation::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar ticklabelrotation parametercolorbar_rightspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar rightspinevisible parametercolorbar_labelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar labelsize parametercolorbar_bottomspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar bottomspinecolor parameterlabel_color::Symbol=black: Color of electrode labels.colorbar_minorticks::Observables.Observable{Any}=Observable{Any}(Makie.IntervalsBetween(5, true)): Colorbar minorticks parametercolorbar_minortickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar minortickalign parameterhighlight_channels::Nothing=nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)colorbar_ticks::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticks parametercolorbar_ticklabelalign::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelalign parametercolorbar_highclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar highclip parametercolorbar_tickcolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar tickcolor parametercolorbar_height::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar height parametercolorbar_labelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar labelfont parameter
Returns
fig::Figure: The generated Makie Figure containing the grid of topoplots.
Examples
Basic Usage
# Plot first 10 components (default)
fig = plot_topography(ica)
# Plot specific range of components
fig = plot_topography(ica, component_selection = components(5:15))
# Plot specific components
fig = plot_topography(ica, component_selection = components([1, 3, 5, 7]))
# Plot all components (if screen can handle it)
fig = plot_topography(ica, component_selection = components())Advanced Selection
# Plot components with custom selection
fig = plot_topography(ica,
component_selection = components(1:10) # First 10 components
)
# Plot even-numbered components
fig = plot_topography(ica,
component_selection = components(2:2:20) # Even components 2, 4, 6, ..., 20
)EegFun.plot_topography Method
Create a topographic plot for a specific epoch of MultiDataFrameEeg data.
EegFun.plot_topography Method
Create a topographic plot for a single SingleDataFrameEeg; supports n_topo time bins.
EegFun.plot_topography Method
plot_topography(tf::TimeFreqData;
freq_range::Tuple{Real, Real},
interval_selection::Interval = times(),
baseline_interval = nothing,
baseline_method::Symbol = :db,
kwargs...)Plot a topographic map of average power within a frequency band and time window.
Arguments
tf::TimeFreqData: Time-frequency datafreq_range::Tuple{Real, Real}: Frequency range to average over (e.g.,(8.0, 12.0)for alpha)interval_selection::Interval: Time window (default: all time points)baseline_interval: Baseline window as(start, stop)in seconds (e.g.,(-0.3, 0.0)). Default:nothingbaseline_method::Symbol: Baseline method (default::db). Options::db,:absolute,:relative,:relchange,:percent,:zscore
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.colorbar_nsteps::Observables.Observable{Any}=Observable{Any}(100): Colorbar nsteps parametercolorbar_leftspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar leftspinevisible parametercolorbar_limits::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar limits parameterpoint_markersize::Int64=12: Size of electrode point markers.colorbar_size::Observables.Observable{Any}=Observable{Any}(12): Colorbar size parametercolorbar_alignmode::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Inside()): Colorbar alignmode parametercolorbar_topspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar topspinecolor parametercolorbar_plot_numbers::Vector{Any}=Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_ticksize::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar ticksize parametercolorbar_minortickcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar minortickcolor parametercolorbar_halign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar halign parametercolorbar_ticksvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticksvisible parametercolorbar_tellheight::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellheight parametercolorbar_vertical::Observables.Observable{Any}=Observable{Any}(true): Colorbar vertical parametercolorbar_ticklabelspace::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelspace parametercolorbar_ticklabelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar ticklabelfont parametercolorbar_minortickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar minortickwidth parametercolorbar_width::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar width parametercolorbar_leftspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar leftspinecolor parametershow_title::Bool=true: Whether to show the titlecolorbar_colorrange::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar colorrange parametercolorbar_plot::Bool=true: Whether to display the colorbarcolorbar_labelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar labelcolor parameternum_levels::Int64=20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.gridscale::Int64=75: Grid resolution for interpolationylim::Nothing=nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.method::Symbol=thin_plate: Interpolation method: :multiquadratic, :inverse_multiquadratic, :gaussian, :inverse_quadratic, :thin_plate, :polyharmonic, :shepard, :nearest, :spherical_spline. See https://eljungsk.github.io/ScatteredInterpolation.jl/dev/methods/ for details on methods.colorbar_minorticksvisible::Observables.Observable{Any}=Observable{Any}(false): Colorbar minorticksvisible parametercolorbar_valign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar valign parameterfigure_title::String=Topography Plot: Title for the plot windowtitle::String=: Plot titlecolorbar_label::String=μV: Label for the colorbarlabel_xoffset::Int64=0: X-axis offset for electrode labels.colorbar_colormap::Observables.Observable{Any}=Observable{Any}(:viridis): Colorbar colormap parametercolorbar_flip_vertical_label::Observables.Observable{Any}=Observable{Any}(false): Colorbar flip_vertical_label parameterpoint_color::Symbol=black: Color of electrode points.colorbar_lowclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar lowclip parametercolorbar_scale::Observables.Observable{Any}=Observable{Any}(identity): Colorbar scale parametercolorbar_flipaxis::Observables.Observable{Any}=Observable{Any}(true): Colorbar flipaxis parametercolorbar_tellwidth::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellwidth parametercolorbar_position::Tuple{Int64, Int64}=(1, 2): Colorbar position as (row, col) tuple, or :right, :belowcolorbar_labelvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar labelvisible parameterdims::Nothing=nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish gridcolormap::Symbol=jet: Colormap for the topographytime_unit::Symbol=s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.colorbar_ticklabelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar ticklabelsize parametercolorbar_rightspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar rightspinecolor parametercolorbar_labelpadding::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar labelpadding parametercolorbar_spinewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar spinewidth parametercolorbar_bottomspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar bottomspinevisible parametercomponent_selection::EegFun.var"#components##0#components##1"=#components##0: Function that returns boolean vector for component filteringcolorbar_ticklabelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar ticklabelcolor parameteruse_global_scale::Bool=false: Do multiple ICA topoplots share the same color scale based on min/max across all components?point_marker::Symbol=circle: Marker style for electrode points.label_plot::Bool=true: Whether to plot electrode labels.colorbar_tickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar tickwidth parameterdisplay_plot::Bool=true: Whether to display the plotinteractive::Bool=true: Whether to enable interactive featurescolorbar_tickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar tickalign parametercolorbar_ticklabelpad::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar ticklabelpad parameterlabel_yoffset::Int64=0: Y-axis offset for electrode labels.colorbar_labelrotation::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar labelrotation parametercolorbar_ticklabelsvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticklabelsvisible parameterhead_linewidth::Int64=2: Line width of the head shape outline.head_radius::Float64=1.0: Radius of the head shape in mm.title_fontsize::Int64=16: Font size for the titlecolorbar_topspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar topspinevisible parameterhead_color::Symbol=black: Color of the head shape outline.colorbar_minorticksize::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar minorticksize parametercolorbar_tickformat::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar tickformat parameterlabel_fontsize::Int64=20: Font size for electrode labels.colorbar_ticklabelrotation::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar ticklabelrotation parametercolorbar_rightspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar rightspinevisible parametercolorbar_labelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar labelsize parametercolorbar_bottomspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar bottomspinecolor parameterlabel_color::Symbol=black: Color of electrode labels.colorbar_minorticks::Observables.Observable{Any}=Observable{Any}(Makie.IntervalsBetween(5, true)): Colorbar minorticks parametercolorbar_minortickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar minortickalign parameterhighlight_channels::Nothing=nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)colorbar_ticks::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticks parametercolorbar_ticklabelalign::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelalign parametercolorbar_highclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar highclip parametercolorbar_tickcolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar tickcolor parametercolorbar_height::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar height parametercolorbar_labelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar labelfont parameter
Returns
- Named tuple
(fig, ax)
Examples
# Alpha-band power (8-12 Hz) in 300-500ms window with dB baseline
plot_topography(tf, freq_range=(8.0, 12.0), interval_selection=times(0.3, 0.5),
baseline_interval=(-0.3, 0.0))
# Theta-band power across full time window
plot_topography(tf, freq_range=(4.0, 7.0))EegFun.plot_topography Method
plot_topography(filepath::String; input_dir=pwd(), participant_selection=participants(), kwargs...)Load data and create topographic plots. Accepts either a .jld2 filepath or a pattern to discover and plot all matching files (one plot per file).
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.colorbar_nsteps::Observables.Observable{Any}=Observable{Any}(100): Colorbar nsteps parametercolorbar_leftspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar leftspinevisible parametercolorbar_limits::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar limits parameterpoint_markersize::Int64=12: Size of electrode point markers.colorbar_size::Observables.Observable{Any}=Observable{Any}(12): Colorbar size parametercolorbar_alignmode::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Inside()): Colorbar alignmode parametercolorbar_topspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar topspinecolor parametercolorbar_plot_numbers::Vector{Any}=Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_ticksize::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar ticksize parametercolorbar_minortickcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar minortickcolor parametercolorbar_halign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar halign parametercolorbar_ticksvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticksvisible parametercolorbar_tellheight::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellheight parametercolorbar_vertical::Observables.Observable{Any}=Observable{Any}(true): Colorbar vertical parametercolorbar_ticklabelspace::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelspace parametercolorbar_ticklabelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar ticklabelfont parametercolorbar_minortickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar minortickwidth parametercolorbar_width::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar width parametercolorbar_leftspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar leftspinecolor parametershow_title::Bool=true: Whether to show the titlecolorbar_colorrange::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar colorrange parametercolorbar_plot::Bool=true: Whether to display the colorbarcolorbar_labelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar labelcolor parameternum_levels::Int64=20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.gridscale::Int64=75: Grid resolution for interpolationylim::Nothing=nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.method::Symbol=thin_plate: Interpolation method: :multiquadratic, :inverse_multiquadratic, :gaussian, :inverse_quadratic, :thin_plate, :polyharmonic, :shepard, :nearest, :spherical_spline. See https://eljungsk.github.io/ScatteredInterpolation.jl/dev/methods/ for details on methods.colorbar_minorticksvisible::Observables.Observable{Any}=Observable{Any}(false): Colorbar minorticksvisible parametercolorbar_valign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar valign parameterfigure_title::String=Topography Plot: Title for the plot windowtitle::String=: Plot titlecolorbar_label::String=μV: Label for the colorbarlabel_xoffset::Int64=0: X-axis offset for electrode labels.colorbar_colormap::Observables.Observable{Any}=Observable{Any}(:viridis): Colorbar colormap parametercolorbar_flip_vertical_label::Observables.Observable{Any}=Observable{Any}(false): Colorbar flip_vertical_label parameterpoint_color::Symbol=black: Color of electrode points.colorbar_lowclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar lowclip parametercolorbar_scale::Observables.Observable{Any}=Observable{Any}(identity): Colorbar scale parametercolorbar_flipaxis::Observables.Observable{Any}=Observable{Any}(true): Colorbar flipaxis parametercolorbar_tellwidth::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellwidth parametercolorbar_position::Tuple{Int64, Int64}=(1, 2): Colorbar position as (row, col) tuple, or :right, :belowcolorbar_labelvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar labelvisible parameterdims::Nothing=nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish gridcolormap::Symbol=jet: Colormap for the topographytime_unit::Symbol=s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.colorbar_ticklabelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar ticklabelsize parametercolorbar_rightspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar rightspinecolor parametercolorbar_labelpadding::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar labelpadding parametercolorbar_spinewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar spinewidth parametercolorbar_bottomspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar bottomspinevisible parametercomponent_selection::EegFun.var"#components##0#components##1"=#components##0: Function that returns boolean vector for component filteringcolorbar_ticklabelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar ticklabelcolor parameteruse_global_scale::Bool=false: Do multiple ICA topoplots share the same color scale based on min/max across all components?point_marker::Symbol=circle: Marker style for electrode points.label_plot::Bool=true: Whether to plot electrode labels.colorbar_tickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar tickwidth parameterdisplay_plot::Bool=true: Whether to display the plotinteractive::Bool=true: Whether to enable interactive featurescolorbar_tickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar tickalign parametercolorbar_ticklabelpad::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar ticklabelpad parameterlabel_yoffset::Int64=0: Y-axis offset for electrode labels.colorbar_labelrotation::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar labelrotation parametercolorbar_ticklabelsvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticklabelsvisible parameterhead_linewidth::Int64=2: Line width of the head shape outline.head_radius::Float64=1.0: Radius of the head shape in mm.title_fontsize::Int64=16: Font size for the titlecolorbar_topspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar topspinevisible parameterhead_color::Symbol=black: Color of the head shape outline.colorbar_minorticksize::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar minorticksize parametercolorbar_tickformat::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar tickformat parameterlabel_fontsize::Int64=20: Font size for electrode labels.colorbar_ticklabelrotation::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar ticklabelrotation parametercolorbar_rightspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar rightspinevisible parametercolorbar_labelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar labelsize parametercolorbar_bottomspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar bottomspinecolor parameterlabel_color::Symbol=black: Color of electrode labels.colorbar_minorticks::Observables.Observable{Any}=Observable{Any}(Makie.IntervalsBetween(5, true)): Colorbar minorticks parametercolorbar_minortickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar minortickalign parameterhighlight_channels::Nothing=nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)colorbar_ticks::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticks parametercolorbar_ticklabelalign::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelalign parametercolorbar_highclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar highclip parametercolorbar_tickcolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar tickcolor parametercolorbar_height::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar height parametercolorbar_labelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar labelfont parameter
Examples
plot_topography("grand_average_erps_good.jld2")
plot_topography("erps_good")
plot_topography("erps_good", participant_selection = participants(1))EegFun.plot_topography Method
Create a multi-panel topographic plot for a vector of datasets, one subplot per condition.
sourceEegFun.plot_topography Method
Average epochs per condition, then delegate to the Vector{ErpData} topography method.
EegFun.plot_topography_stats Method
plot_topography_stats(result::StatsResult;
n_topos::Int = 10,
interval_selection::Interval = times(),
topo_data::Symbol = :tvalues,
highlight_significant::Bool = true,
highlight_color = :white,
highlight_marker::Symbol = :circle,
highlight_size::Real = 8,
highlight_threshold::Real = 0.5,
kwargs...)Plot a grid of topographic maps showing statistical results across time windows.
Each panel shows the spatial distribution of t-statistics (or difference amplitudes) averaged within a time window, with significant channels highlighted as markers.
Arguments
result::StatsResult: Results fromanalytic_testorpermutation_testn_topos::Int: Number of topographic panels (default: 10)interval_selection::Interval: Time window to display (default: full range). Usetimes(start, stop)to specifytopo_data::Symbol: What to display on the topographic maps::tvalues(default) — t-statistics from the statistical test:difference— difference wave amplitude (condition A − condition B)
highlight_significant::Bool: Whether to overlay markers on significant channels (default: true)highlight_color: Color for significance markers (default::white)highlight_marker::Symbol: Marker symbol for significant channels (default::circle). Options::circle,:cross,:diamond,:star5,:xcross,:utriangle,:dtriangle, etc.highlight_size::Real: Size of significance markers (default: 8)highlight_threshold::Real: Proportion of time points within a window that must be significant to mark a channel (default: 0.5).0.0= any single time point (union),0.5= majority,1.0= all time points (intersection)
Additional keyword arguments from PLOT_TOPOGRAPHY_KWARGS are supported:
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.colorbar_nsteps::Observables.Observable{Any}=Observable{Any}(100): Colorbar nsteps parametercolorbar_leftspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar leftspinevisible parametercolorbar_limits::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar limits parameterpoint_markersize::Int64=12: Size of electrode point markers.colorbar_size::Observables.Observable{Any}=Observable{Any}(12): Colorbar size parametercolorbar_alignmode::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Inside()): Colorbar alignmode parametercolorbar_topspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar topspinecolor parametercolorbar_plot_numbers::Vector{Any}=Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_ticksize::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar ticksize parametercolorbar_minortickcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar minortickcolor parametercolorbar_halign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar halign parametercolorbar_ticksvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticksvisible parametercolorbar_tellheight::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellheight parametercolorbar_vertical::Observables.Observable{Any}=Observable{Any}(true): Colorbar vertical parametercolorbar_ticklabelspace::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelspace parametercolorbar_ticklabelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar ticklabelfont parametercolorbar_minortickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar minortickwidth parametercolorbar_width::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar width parametercolorbar_leftspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar leftspinecolor parametershow_title::Bool=true: Whether to show the titlecolorbar_colorrange::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar colorrange parametercolorbar_plot::Bool=true: Whether to display the colorbarcolorbar_labelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar labelcolor parameternum_levels::Int64=20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.gridscale::Int64=75: Grid resolution for interpolationylim::Nothing=nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.method::Symbol=thin_plate: Interpolation method: :multiquadratic, :inverse_multiquadratic, :gaussian, :inverse_quadratic, :thin_plate, :polyharmonic, :shepard, :nearest, :spherical_spline. See https://eljungsk.github.io/ScatteredInterpolation.jl/dev/methods/ for details on methods.colorbar_minorticksvisible::Observables.Observable{Any}=Observable{Any}(false): Colorbar minorticksvisible parametercolorbar_valign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar valign parameterfigure_title::String=Topography Plot: Title for the plot windowtitle::String=: Plot titlecolorbar_label::String=μV: Label for the colorbarlabel_xoffset::Int64=0: X-axis offset for electrode labels.colorbar_colormap::Observables.Observable{Any}=Observable{Any}(:viridis): Colorbar colormap parametercolorbar_flip_vertical_label::Observables.Observable{Any}=Observable{Any}(false): Colorbar flip_vertical_label parameterpoint_color::Symbol=black: Color of electrode points.colorbar_lowclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar lowclip parametercolorbar_scale::Observables.Observable{Any}=Observable{Any}(identity): Colorbar scale parametercolorbar_flipaxis::Observables.Observable{Any}=Observable{Any}(true): Colorbar flipaxis parametercolorbar_tellwidth::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellwidth parametercolorbar_position::Tuple{Int64, Int64}=(1, 2): Colorbar position as (row, col) tuple, or :right, :belowcolorbar_labelvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar labelvisible parameterdims::Nothing=nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish gridcolormap::Symbol=jet: Colormap for the topographytime_unit::Symbol=s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.colorbar_ticklabelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar ticklabelsize parametercolorbar_rightspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar rightspinecolor parametercolorbar_labelpadding::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar labelpadding parametercolorbar_spinewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar spinewidth parametercolorbar_bottomspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar bottomspinevisible parametercomponent_selection::EegFun.var"#components##0#components##1"=#components##0: Function that returns boolean vector for component filteringcolorbar_ticklabelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar ticklabelcolor parameteruse_global_scale::Bool=false: Do multiple ICA topoplots share the same color scale based on min/max across all components?point_marker::Symbol=circle: Marker style for electrode points.label_plot::Bool=true: Whether to plot electrode labels.colorbar_tickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar tickwidth parameterdisplay_plot::Bool=true: Whether to display the plotinteractive::Bool=true: Whether to enable interactive featurescolorbar_tickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar tickalign parametercolorbar_ticklabelpad::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar ticklabelpad parameterlabel_yoffset::Int64=0: Y-axis offset for electrode labels.colorbar_labelrotation::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar labelrotation parametercolorbar_ticklabelsvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticklabelsvisible parameterhead_linewidth::Int64=2: Line width of the head shape outline.head_radius::Float64=1.0: Radius of the head shape in mm.title_fontsize::Int64=16: Font size for the titlecolorbar_topspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar topspinevisible parameterhead_color::Symbol=black: Color of the head shape outline.colorbar_minorticksize::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar minorticksize parametercolorbar_tickformat::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar tickformat parameterlabel_fontsize::Int64=20: Font size for electrode labels.colorbar_ticklabelrotation::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar ticklabelrotation parametercolorbar_rightspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar rightspinevisible parametercolorbar_labelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar labelsize parametercolorbar_bottomspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar bottomspinecolor parameterlabel_color::Symbol=black: Color of electrode labels.colorbar_minorticks::Observables.Observable{Any}=Observable{Any}(Makie.IntervalsBetween(5, true)): Colorbar minorticks parametercolorbar_minortickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar minortickalign parameterhighlight_channels::Nothing=nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)colorbar_ticks::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticks parametercolorbar_ticklabelalign::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelalign parametercolorbar_highclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar highclip parametercolorbar_tickcolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar tickcolor parametercolorbar_height::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar height parametercolorbar_labelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar labelfont parameter
Returns
- Named tuple
(fig, axes, colorbar)
Examples
# Basic usage with analytic test
result = analytic_test(prepared, correction_method=:no)
plot_topography_stats(result)
# Show difference wave amplitudes instead of t-values
plot_topography_stats(result, topo_data=:difference)
# Focus on a specific time window with more panels
plot_topography_stats(result, interval_selection=times(0.1, 0.4), n_topos=15)
# Custom marker style for significant channels
plot_topography_stats(result, highlight_marker=:star5, highlight_color=:yellow, highlight_size=12)EegFun.plot_topography_stats Method
plot_topography_stats(result::TFStatsResult;
freq_range::Tuple{Real, Real},
n_topos::Int = 10,
interval_selection::Interval = times(),
topo_data::Symbol = :tvalues,
highlight_significant::Bool = true,
highlight_color = :white,
highlight_marker::Symbol = :circle,
highlight_size::Real = 8,
highlight_threshold::Real = 0.5,
kwargs...)Plot a grid of topographic maps from TF statistical results across time windows for a selected frequency band.
Each panel shows the spatial distribution of t-statistics (or power difference) averaged within a time window and frequency band, with significant channels highlighted.
A channel is marked significant when the proportion of significant time×frequency bins within the panel's window meets or exceeds highlight_threshold.
Arguments
result::TFStatsResult: TF statistical result (frompermutation_testoranalytic_test)freq_range::Tuple{Real, Real}: Frequency range to average over (e.g.,(8.0, 12.0))n_topos::Int: Number of topographic panels (default: 10)interval_selection::Interval: Time window to display (default: full range). Usetimes(start, stop)to specifytopo_data::Symbol::tvalues(default) or:differencehighlight_significant::Bool: Overlay markers on significant channels (default: true)highlight_threshold::Real: Proportion of time×freq bins that must be significant to mark a channel (default: 0.5).0.0= any bin,1.0= all binshighlight_color,highlight_marker,highlight_size: Marker styling
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
point_plot::Bool=true: Whether to plot electrode points.colorbar_nsteps::Observables.Observable{Any}=Observable{Any}(100): Colorbar nsteps parametercolorbar_leftspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar leftspinevisible parametercolorbar_limits::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar limits parameterpoint_markersize::Int64=12: Size of electrode point markers.colorbar_size::Observables.Observable{Any}=Observable{Any}(12): Colorbar size parametercolorbar_alignmode::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Inside()): Colorbar alignmode parametercolorbar_topspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar topspinecolor parametercolorbar_plot_numbers::Vector{Any}=Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_ticksize::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar ticksize parametercolorbar_minortickcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar minortickcolor parametercolorbar_halign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar halign parametercolorbar_ticksvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticksvisible parametercolorbar_tellheight::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellheight parametercolorbar_vertical::Observables.Observable{Any}=Observable{Any}(true): Colorbar vertical parametercolorbar_ticklabelspace::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelspace parametercolorbar_ticklabelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar ticklabelfont parametercolorbar_minortickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar minortickwidth parametercolorbar_width::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar width parametercolorbar_leftspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar leftspinecolor parametershow_title::Bool=true: Whether to show the titlecolorbar_colorrange::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar colorrange parametercolorbar_plot::Bool=true: Whether to display the colorbarcolorbar_labelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar labelcolor parameternum_levels::Int64=20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.gridscale::Int64=75: Grid resolution for interpolationylim::Nothing=nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.method::Symbol=thin_plate: Interpolation method: :multiquadratic, :inverse_multiquadratic, :gaussian, :inverse_quadratic, :thin_plate, :polyharmonic, :shepard, :nearest, :spherical_spline. See https://eljungsk.github.io/ScatteredInterpolation.jl/dev/methods/ for details on methods.colorbar_minorticksvisible::Observables.Observable{Any}=Observable{Any}(false): Colorbar minorticksvisible parametercolorbar_valign::Observables.Observable{Any}=Observable{Any}(:center): Colorbar valign parameterfigure_title::String=Topography Plot: Title for the plot windowtitle::String=: Plot titlecolorbar_label::String=μV: Label for the colorbarlabel_xoffset::Int64=0: X-axis offset for electrode labels.colorbar_colormap::Observables.Observable{Any}=Observable{Any}(:viridis): Colorbar colormap parametercolorbar_flip_vertical_label::Observables.Observable{Any}=Observable{Any}(false): Colorbar flip_vertical_label parameterpoint_color::Symbol=black: Color of electrode points.colorbar_lowclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar lowclip parametercolorbar_scale::Observables.Observable{Any}=Observable{Any}(identity): Colorbar scale parametercolorbar_flipaxis::Observables.Observable{Any}=Observable{Any}(true): Colorbar flipaxis parametercolorbar_tellwidth::Observables.Observable{Any}=Observable{Any}(true): Colorbar tellwidth parametercolorbar_position::Tuple{Int64, Int64}=(1, 2): Colorbar position as (row, col) tuple, or :right, :belowcolorbar_labelvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar labelvisible parameterdims::Nothing=nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish gridcolormap::Symbol=jet: Colormap for the topographytime_unit::Symbol=s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.colorbar_ticklabelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar ticklabelsize parametercolorbar_rightspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar rightspinecolor parametercolorbar_labelpadding::Observables.Observable{Any}=Observable{Any}(5.0f0): Colorbar labelpadding parametercolorbar_spinewidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar spinewidth parametercolorbar_bottomspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar bottomspinevisible parametercomponent_selection::EegFun.var"#components##0#components##1"=#components##0: Function that returns boolean vector for component filteringcolorbar_ticklabelcolor::Observables.Observable{Any}=Observable{Any}(:black): Colorbar ticklabelcolor parameteruse_global_scale::Bool=false: Do multiple ICA topoplots share the same color scale based on min/max across all components?point_marker::Symbol=circle: Marker style for electrode points.label_plot::Bool=true: Whether to plot electrode labels.colorbar_tickwidth::Observables.Observable{Any}=Observable{Any}(1.0f0): Colorbar tickwidth parameterdisplay_plot::Bool=true: Whether to display the plotinteractive::Bool=true: Whether to enable interactive featurescolorbar_tickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar tickalign parametercolorbar_ticklabelpad::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar ticklabelpad parameterlabel_yoffset::Int64=0: Y-axis offset for electrode labels.colorbar_labelrotation::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar labelrotation parametercolorbar_ticklabelsvisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar ticklabelsvisible parameterhead_linewidth::Int64=2: Line width of the head shape outline.head_radius::Float64=1.0: Radius of the head shape in mm.title_fontsize::Int64=16: Font size for the titlecolorbar_topspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar topspinevisible parameterhead_color::Symbol=black: Color of the head shape outline.colorbar_minorticksize::Observables.Observable{Any}=Observable{Any}(3.0f0): Colorbar minorticksize parametercolorbar_tickformat::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar tickformat parameterlabel_fontsize::Int64=20: Font size for electrode labels.colorbar_ticklabelrotation::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar ticklabelrotation parametercolorbar_rightspinevisible::Observables.Observable{Any}=Observable{Any}(true): Colorbar rightspinevisible parametercolorbar_labelsize::Observables.Observable{Any}=Observable{Any}(14): Colorbar labelsize parametercolorbar_bottomspinecolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar bottomspinecolor parameterlabel_color::Symbol=black: Color of electrode labels.colorbar_minorticks::Observables.Observable{Any}=Observable{Any}(Makie.IntervalsBetween(5, true)): Colorbar minorticks parametercolorbar_minortickalign::Observables.Observable{Any}=Observable{Any}(0.0f0): Colorbar minortickalign parameterhighlight_channels::Nothing=nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)colorbar_ticks::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticks parametercolorbar_ticklabelalign::Observables.Observable{Any}=Observable{Any}(Makie.Automatic()): Colorbar ticklabelalign parametercolorbar_highclip::Observables.Observable{Any}=Observable{Any}(nothing): Colorbar highclip parametercolorbar_tickcolor::Observables.Observable{Any}=Observable{Any}(RGB{Float32}(0.0, 0.0, 0.0)): Colorbar tickcolor parametercolorbar_height::Observables.Observable{Any}=Observable{Any}(GridLayoutBase.Auto(true, 1.0f0)): Colorbar height parametercolorbar_labelfont::Observables.Observable{Any}=Observable{Any}(:regular): Colorbar labelfont parameter
Returns
- Named tuple
(fig, axes, colorbar)
Examples
# Alpha-band statistics
plot_topography_stats(result, freq_range=(8.0, 12.0))
# Theta-band with more panels and lower threshold
plot_topography_stats(result, freq_range=(4.0, 7.0), n_topos=15, highlight_threshold=0.3)
# Specific time window
plot_topography_stats(result, freq_range=(8.0, 12.0), interval_selection=times(0.1, 0.5))EegFun.plot_trigger_overview Method
plot_trigger_overview(trigger_times, trigger_values, trigger_count)Plot trigger events as a scatter plot with vertical lines.
Arguments
trigger_times: Vector of times when triggers occurredtrigger_values: Vector of trigger values at those timestrigger_count: OrderedDict mapping trigger values to their counts
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
y_min_limit::Float64=-0.1: Minimum y-axis limit.linewidth_trigger::Int64=1: Line width for trigger vertical lines.yminorgrid::Bool=false: Whether to show y-axis minor gridmin_window_size::Float64=0.1: Minimum size of the time interval in seconds.xminorgrid::Bool=false: Whether to show x-axis minor gridlabel_fontsize::Int64=20: Font size for labels.initial_position::Float64=-2.0: Initial position of the time interval in seconds.window_size::Float64=10.0: Size of the time window to display in seconds.max_window_size::Float64=100.0: Maximum size of the time interval in seconds.ignore_triggers::Vector{Int64}=Int64[]: Vector of trigger codes to ignore.y_max_limit::Float64=0.15: Maximum y-axis limit.timeline_width::Int64=2: Line width for the main timeline.marker_size::Int64=15: Size of markers in the trigger overview plot.line_offset::Float64=0.1: Offset for trigger vertical lines.display_plot::Bool=true: Whether to display the plot.event_line_height::Float64=0.05: Height of event lines.event_line_width::Int64=1: Line width for individual event lines.time_label_offset::Float64=-0.001: Vertical offset for time labels.window_size_step::Float64=1.0: Step size for window size slider.ygrid::Bool=false: Whether to show y-axis gridposition_step::Float64=0.5: Step size for position slider.font_size::Int64=24: Font size for text elements.xgrid::Bool=false: Whether to show x-axis grid
Returns
fig: The Makie Figure objectax: The Axis object containing the plot
EegFun.plot_trigger_timing Method
plot_trigger_timing(dat::ContinuousData; kwargs...)Plot trigger timing with interactive x-axis sliders for scrolling and window size.
Arguments
dat::ContinuousData: The ContinuousData object containing the triggersignore_triggers: Vector of trigger codes to ignore (optional)Other plotting parameters (window_size, display_plot, etc.)
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
y_min_limit::Float64=-0.1: Minimum y-axis limit.linewidth_trigger::Int64=1: Line width for trigger vertical lines.yminorgrid::Bool=false: Whether to show y-axis minor gridmin_window_size::Float64=0.1: Minimum size of the time interval in seconds.xminorgrid::Bool=false: Whether to show x-axis minor gridlabel_fontsize::Int64=20: Font size for labels.initial_position::Float64=-2.0: Initial position of the time interval in seconds.window_size::Float64=10.0: Size of the time window to display in seconds.max_window_size::Float64=100.0: Maximum size of the time interval in seconds.ignore_triggers::Vector{Int64}=Int64[]: Vector of trigger codes to ignore.y_max_limit::Float64=0.15: Maximum y-axis limit.timeline_width::Int64=2: Line width for the main timeline.marker_size::Int64=15: Size of markers in the trigger overview plot.line_offset::Float64=0.1: Offset for trigger vertical lines.display_plot::Bool=true: Whether to display the plot.event_line_height::Float64=0.05: Height of event lines.event_line_width::Int64=1: Line width for individual event lines.time_label_offset::Float64=-0.001: Vertical offset for time labels.window_size_step::Float64=1.0: Step size for window size slider.ygrid::Bool=false: Whether to show y-axis gridposition_step::Float64=0.5: Step size for position slider.font_size::Int64=24: Font size for text elements.xgrid::Bool=false: Whether to show x-axis grid
Returns
fig::Figure: The Makie figure objectax::Axis: The Makie axis object
Example
# Plot all triggers
fig, ax = plot_trigger_timing(dat)
# Ignore specific trigger codes
fig, ax = plot_trigger_timing(dat; ignore_triggers=[1, 255])