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_spectrumEegFun.plot_channel_summaryEegFun.plot_channel_summary!EegFun.plot_confusion_matrixEegFun.plot_correlation_heatmapEegFun.plot_correlation_heatmap!EegFun.plot_databrowserEegFun.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_errorbarEegFun.plot_erp_errorbarEegFun.plot_erp_errorbarEegFun.plot_erp_errorbar!EegFun.plot_erp_errorbar!EegFun.plot_erp_filter_guiEegFun.plot_erp_filter_guiEegFun.plot_erp_filter_guiEegFun.plot_erp_filter_guiEegFun.plot_erp_imageEegFun.plot_erp_measurement_guiEegFun.plot_erp_measurement_guiEegFun.plot_erp_measurement_guiEegFun.plot_erp_measurementsEegFun.plot_erp_statsEegFun.plot_filter_responseEegFun.plot_gfpEegFun.plot_guiEegFun.plot_ica_component_activationEegFun.plot_ica_component_spectrumEegFun.plot_joint_probabilityEegFun.plot_joint_probability!EegFun.plot_layoutEegFun.plot_layout!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_stat_heatmapEegFun.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_3dEegFun.plot_topography_3dEegFun.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.
General Plot Settings
add_xy_origin::Bool = true: Whether to add origin lines at x=0 and y=0alpha_normal::Float64 = 0.2: Transparency for normal channels.alpha_rejected::Float64 = 1.0: Transparency for rejected channels.colormap_name::Nothing = nothing: Colormap name (e.g., :Set1_9, :tab20).display_plot::Bool = true: Display plot.linewidth_normal::Int64 = 1: Line width for normal channels.linewidth_rejected::Int64 = 2: Line width for rejected channels.selection_threshold::Int64 = 50: Distance threshold for channel selection.xgrid::Bool = false: Whether to show x-axis gridxlim::Nothing = nothing: X-axis limits as (min, max) tuple or nothing for auto-scalingxminorgrid::Bool = false: Whether to show x-axis minor gridygrid::Bool = false: Whether to show y-axis gridylim::Nothing = nothing: Y-axis limits as (min, max) tuple or nothing for auto-scalingyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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_raw::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_raw::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.
General Plot Settings
add_xy_origin::Bool = true: Whether to add origin lines at x=0 and y=0alpha_normal::Float64 = 0.2: Transparency for normal channels.alpha_rejected::Float64 = 1.0: Transparency for rejected channels.colormap_name::Nothing = nothing: Colormap name (e.g., :Set1_9, :tab20).display_plot::Bool = true: Display plot.linewidth_normal::Int64 = 1: Line width for normal channels.linewidth_rejected::Int64 = 2: Line width for rejected channels.selection_threshold::Int64 = 50: Distance threshold for channel selection.xgrid::Bool = false: Whether to show x-axis gridxlim::Nothing = nothing: X-axis limits as (min, max) tuple or nothing for auto-scalingxminorgrid::Bool = false: Whether to show x-axis minor gridygrid::Bool = false: Whether to show y-axis gridylim::Nothing = nothing: Y-axis limits as (min, max) tuple or nothing for auto-scalingyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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_raw::EpochData, epochs_repaired::EpochData, artifacts::EpochRejectionInfo; channel_selection::Function=channels(), kwargs...)Interactive plot comparison between original and repaired epochs with navigation buttons.
Arguments
epochs_raw::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.
General Plot Settings
add_xy_origin::Bool = true: Whether to add origin lines at x=0 and y=0alpha_normal::Float64 = 0.2: Transparency for normal channels.alpha_rejected::Float64 = 1.0: Transparency for rejected channels.colormap_name::Nothing = nothing: Colormap name (e.g., :Set1_9, :tab20).display_plot::Bool = true: Display plot.linewidth_normal::Int64 = 1: Line width for normal channels.linewidth_rejected::Int64 = 2: Line width for rejected channels.selection_threshold::Int64 = 50: Distance threshold for channel selection.xgrid::Bool = false: Whether to show x-axis gridxlim::Nothing = nothing: X-axis limits as (min, max) tuple or nothing for auto-scalingxminorgrid::Bool = false: Whether to show x-axis minor gridygrid::Bool = false: Whether to show y-axis gridylim::Nothing = nothing: Y-axis limits as (min, max) tuple or nothing for auto-scalingyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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_spectrum Method
plot_channel_spectrum(dat::SpectrumData; kwargs...)Plot a pre-computed power spectrum with interactive controls.
sourceEegFun.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;
channel_selection,
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.
General Plot Settings
average_over::Nothing = nothing: Column to average over (e.g., :epoch). If specified, will compute mean ± 95% CI.bar_alpha::Float64 = 0.7: Bar alpha.bar_color::Symbol = :steelblue: Bar color.bar_width::Float64 = 0.8: Bar width.dims::Nothing = nothing: Tuple (rows, cols) for grid layout. default = _best_rect(n_columns).display_plot::Bool = true: Display plot.error_color::Symbol = :black: Error bar color.error_linewidth::Int64 = 2: Error bar linewidth.label_fontsize::Int64 = 14: Font size for axis labels.plot_title::Nothing = nothing: Plot title.plot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for title.plot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.sort_values::Bool = false: Sort the bars by the values in thecolcolumn in descending order.tick_fontsize::Int64 = 12: Font size for tick labels.xgrid::Bool = false: Whether to show x-axis gridxlabel::String = "Electrode": x-axis label.xminorgrid::Bool = false: Whether to show x-axis minor gridxtick_rotation::Float64 = 0.7853981633974483: Rotation angle for x-axis tick labels.ygrid::Bool = false: Whether to show y-axis gridylabel::String = "": y-axis labelyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
colorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::String = "Correlation": Label for the colorbarcolorbar_plot::Bool = true: Whether to display the colorbarcolorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the heatmapcolorrange::Tuple{Int64, Int64} = (-1, 1): Color range for the heatmap and colorbar (should be -1 to 1 for correlations)display_plot::Bool = true: Whether to display the plotlabel_fontsize::Int64 = 14: Font size for axis labelsmask_range::Nothing = nothing: Optional tuple (min_val, max_val) to mask correlations within this rangenan_color::Symbol = :transparent: Color for NaN valuesplot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for the titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.tick_fontsize::Int64 = 12: Font size for tick labelsxgrid::Bool = false: Whether to show x-axis gridxlabel::String = "": Label for x-axisxminorgrid::Bool = false: Whether to show x-axis minor gridxtick_rotation::Float64 = 0.7853981633974483: Rotation angle for x-axis tick labelsygrid::Bool = false: Whether to show y-axis gridylabel::String = "": Label for y-axisyminorgrid::Bool = false: Whether to show y-axis minor gridytick_rotation::Int64 = 0: Rotation angle for y-axis tick labels
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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
Open a separate data browser window for each dataset in the vector.
sourceEegFun.plot_databrowser Function
Load data from a .jld2 file or pattern and open the data browser.
EegFun.plot_databrowser Method
plot_databrowser(; kwargs...)Open a file-selector window that lets you drag-and-drop EEG files. Selected files are opened in a full interactive data browser via plot_databrowser(dat::EegData). The launcher stays open so you can load additional files.
Supported formats: .jld2, .set, .bdf, .edf, .vhdr, .fif, .xdf.
EegFun.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.
General Plot Settings
add_xy_origin::Bool = true: Add origin lines at x=0 and y=chance (true/false)chance_color::Symbol = :gray: Color for chance level linechance_linestyle::Symbol = :dash: Line style for chance levelchance_linewidth::Int64 = 1: Line width for chance levelcolor::Nothing = nothing: Color for decoding curvedisplay_plot::Bool = true: Display the plot (true/false)error_alpha::Float64 = 0.3: Transparency for error shadingerror_color::Symbol = :blue: Color for error barsfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titleinteractive::Bool = true: Enable interactive features (true/false)linestyle::Nothing = nothing: Line stylelinewidth::Int64 = 2: Line width for decoding curveplot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for plot titlesplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.show_error::Bool = true: Show standard error bars (true/false)sig_alpha::Float64 = 0.5: Transparency for significance markerssig_color::Symbol = :black: Color for significance markersxgrid::Bool = true: Show x-axis grid (true/false)xlabel::String = "Time (s)": Label for x-axisxlim::Nothing = nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedygrid::Bool = true: Show y-axis grid (true/false)ylabel::String = "Classification Accuracy": Label for y-axisylim::Nothing = nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determined
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
add_xy_origin::Bool = true: Whether to add origin lines at x=0 and y=0average_channels::Bool = false: Whether to average across channelsavg_linewidth_multiplier::Float64 = 2.0: Multiplier for average line width.axis_type::Symbol = :standard: Type of axis to draw (:standard or :origin)color::Nothing = nothing: Color for epoch traces (can be a single color or a vector of colors, one per condition)colormap::Nothing = nothing: Colormap for multi-condition plotsdisplay_plot::Bool = true: Whether to display the plotfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)interactive::Bool = true: Whether to enable interactive featureslayout::Symbol = :single: Layout type: :single, :grid, or :topolinewidth::Nothing = nothing: Line width for epoch tracesplot_avg_trials::Bool = true: Whether to draw ERP average overlayplot_title::Nothing = nothing: Plot title. If nothing, automatically determinedplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for plot titlesplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.scale_x_value::Nothing = nothing: X-axis scale value/step size (e.g. 0.1 for 100 ms)scale_y_value::Nothing = nothing: Y-axis scale value/step size (e.g. 50.0 for 50 μV)selection_alpha::Float64 = 0.3: Alpha (transparency) for interactive selection rectanglesselection_color::Symbol = :blue: Color for interactive selection rectanglestheme_fontsize::Nothing = nothing: Font size for themetrial_alpha::Float64 = 0.25: Alpha (transparency) for individual trial tracesxgrid::Bool = false: Whether to show x-axis gridxlabel::String = "Time (s)": Label for x-axisxlim::Nothing = nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool = false: Whether to show x-axis minor gridygrid::Bool = false: Whether to show y-axis gridylabel::String = "μV": Label for y-axisylim::Nothing = nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedyminorgrid::Bool = false: Whether to show y-axis minor gridyreversed::Bool = false: Whether to reverse the y-axiszoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Layout Options
layout_kwargs::@NamedTuple{} = NamedTuple(): Additional parameters to configure grid or topographical layouts (e.g., grid_dims, topo_plot_width, grid_rowgap)
Legend Options
legend::Bool = true: Whether to show the legendlegend_channel::Vector{Any} = Any[]: If plotting multiple plots, within channel to put the legend on.legend_label::String = "": Title for the legendlegend_nbanks::Nothing = nothing: Number of columns for the legend. If nothing, automatically determined.legend_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))
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Examples
plot_epochs("epochs_raw.jld2")
plot_epochs("epochs_raw")
plot_epochs("epochs_raw", 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 = nothing,
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_final") 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.
General Plot Settings
add_xy_origin::Bool = true: Add origin lines at x=0 and y=0 (true/false)average_channels::Bool = false: Average across channels (true/false)axis_type::Symbol = :standard: Type of axis to draw (:standard or :origin)color::Nothing = nothing: Color for ERPs (single color or a vector of colors, one per dataset)colormap::Nothing = nothing: Colormap for multi-channel plotsdisplay_plot::Bool = true: Display the plot (true/false)error_bars::Symbol = :none: Error bars type to plot: :none, :sem, :within_sem, :ci95figure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titlehighlight_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)interactive::Bool = true: Enable interactive features (true/false)linestyle::Nothing = nothing: Line style for ERPs (single style or a vector of styles, one per dataset)linewidth::Nothing = nothing: Line width for ERPsplot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for plot titlesplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.scale_x_value::Nothing = nothing: X-axis scale value/step size (e.g. 0.1 for 100 ms)scale_y_value::Nothing = nothing: Y-axis scale value/step size (e.g. 5.0 for 5 μV)selection_alpha::Float64 = 0.3: Alpha (transparency) for interactive selection rectanglesselection_color::Symbol = :blue: Color for interactive selection rectanglestheme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for x-axis display (😒 or :ms). Only affects axis labels and tick formatting — all intervals remain in seconds.window_title::String = "": Title for the OS plot window. If empty, it's generated automatically.xgrid::Bool = false: Show x-axis grid (true/false)xlabel::String = "Time (s)": Label for x-axisxlim::Nothing = nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool = false: Show x-axis minor grid (true/false)xticks::Nothing = nothing: X-axis tick positions (e.g., -0.1:0.1:0.8 or [0, 0.2, 0.4]). If nothing, automatically determinedygrid::Bool = false: Show y-axis grid (true/false)ylabel::String = "μV": Label for y-axisylim::Nothing = nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedyminorgrid::Bool = false: Show y-axis minor grid (true/false)yreversed::Bool = false: Whether to reverse the y-axisyticks::Nothing = nothing: Y-axis tick positions (e.g., -4:2:4 or [-2, 0, 2]). If nothing, automatically determinedzoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Layout Options
layout_kwargs::@NamedTuple{} = NamedTuple(): Additional parameters to configure grid or topographical layouts (e.g., grid_dims, topo_plot_width, grid_rowgap)
Legend Options
legend::Bool = true: Show the legend (true/false)legend_channel::Vector{Any} = Any[]: Which channel to put the legend on.legend_label::String = "": Title for the legendlegend_nbanks::Nothing = nothing: Number of legend columns.legend_position::Symbol = :lt: Legend position (:lt, :rt, :lb, :rb, or tuple like (:left, :top), or (0.5, 0.5))
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Examples
# Load and plot from file
plot_erp("grand_average_erps_final.jld2")
# Plot all files matching pattern in current directory
plot_erp("erps_final")
# Plot specific participant
plot_erp("erps_final", participant_selection = participants(1))
# With channel selection
plot_erp("erps_final", channel_selection = channels([:PO7, :PO8]), layout = :grid)EegFun.plot_erp_errorbar! Method
plot_erp_errorbar!(fig::Figure, ax::Axis, datasets::Vector{ErpData}; kwargs...)Plot grand-averaged ERP data with error ribbons on an existing axis, mutating the figure and axis.
sourceEegFun.plot_erp_errorbar! Method
plot_erp_errorbar!(fig::Figure, ax::Axis, datasets::Vector{ErpData}; kwargs...)Plot ERP errorbars for multiple datasets into an existing figure and axis.
sourceEegFun.plot_erp_errorbar Method
plot_erp_errorbar(dataset::ErpData; kwargs...)Plot ERP errorbars for a single dataset.
sourceEegFun.plot_erp_errorbar Method
plot_erp_errorbar(datasets::Vector{ErpData}; kwargs...)Plot ERP errorbars for multiple datasets.
sourceEegFun.plot_erp_errorbar Method
plot_erp_errorbar(datasets::Vector{ErpData}; kwargs...)Plot ERP errorbars for multiple datasets.
sourceEegFun.plot_erp_filter_gui Method
plot_erp_filter_gui(filepath::String; kwargs...)Launch a GUI for interactively filtering ERP data from a file.
sourceEegFun.plot_erp_filter_gui Method
plot_erp_filter_gui(erp::Union{ErpData,ContinuousData}; channel::Union{Symbol,Nothing} = nothing)Launch a GUI for interactively filtering a single dataset.
sourceEegFun.plot_erp_filter_gui Method
plot_erp_filter_gui(erps::Vector{<:Union{ErpData,ContinuousData}}; channel::Union{Symbol,Nothing} = nothing)Launch a GUI for interactively filtering multiple datasets.
sourceEegFun.plot_erp_filter_gui Method
plot_erp_filter_gui(; kwargs...)Launch a GUI for interactively filtering ERP data.
sourceEegFun.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.
General Plot Settings
add_xy_origin::Bool = true: Add origin lines at x=0 and y=0 (true/false)boxcar_average::Int64 = 1: Boxcar average window size for smoothing the ERP image (1 = no smoothing)colorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::String = "μV": Label for the colorbarcolorbar_plot::Bool = true: Whether to show the colorbarcolorbar_plot_numbers::Vector{Any} = Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the imagecolorrange::Nothing = nothing: Color range for the image. If nothing, automatically determineddisplay_plot::Bool = true: Display the plot (true/false)figure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titleinteractive::Bool = true: Enable interactive features (true/false)interpolate::Bool = false: Whether to interpolate the heatmap pixels for smoother appearanceplot_erp::Bool = true: Whether to plot ERP average overlayplot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for plot titlesplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.selection_alpha::Float64 = 0.3: Alpha (transparency) for interactive selection rectanglesselection_color::Symbol = :blue: Color for interactive selection rectanglesxgrid::Bool = false: Show x-axis grid (true/false)xlabel::String = "Time (s)": Label for x-axisxlim::Nothing = nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool = false: Show x-axis minor grid (true/false)ygrid::Bool = false: Show y-axis grid (true/false)ylabel::String = "Epoch": Label for y-axisylim::Nothing = nothing: Y-axis limits for ERP waveform as (min, max) tuple. If nothing, automatically determinedyminorgrid::Bool = false: Show y-axis minor grid (true/false)yreversed::Bool = false: Whether to reverse the y-axiszoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Layout Options
layout_kwargs::@NamedTuple{} = NamedTuple(): Additional parameters to configure grid or topographical layouts (e.g., grid_dims, topo_plot_width, grid_rowgap)
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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_measurement_gui Method
plot_erp_measurement_gui(erp::Union{ErpData,EpochData}; kwargs...)Launch a GUI for interacting with ERP measurements for a single dataset.
sourceEegFun.plot_erp_measurement_gui Method
plot_erp_measurement_gui(filepath::String; kwargs...)Launch a GUI for interacting with ERP measurements from a file.
sourceEegFun.plot_erp_measurement_gui Method
plot_erp_measurement_gui(erps::Vector{<:Union{ErpData,EpochData}}; kwargs...)Launch a GUI for interacting with ERP measurements for multiple datasets.
sourceEegFun.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)average_channels::Bool: Evaluate measurement across a spatially pooled ROI waveform instead of discrete individual channels (default: false).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.
General Plot Settings
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_direction::Symbol = :onset: Direction for fractional peak latency: :onset (before peak) or :offset (after peak)fractional_peak_fraction::Float64 = 0.5: Fraction for fractional peak latency (0.0-1.0). Finds latency where amplitude is this fraction of 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.
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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_final.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_final.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.
General Plot Settings
add_xy_origin::Bool = true: Add origin lines at x=0 and y=0 (true/false)average_channels::Bool = false: Average across channels (true/false)axis_type::Symbol = :standard: Type of axis to draw (:standard or :origin)color::Nothing = nothing: Color for ERPs (single color or a vector of colors, one per dataset)colormap::Nothing = nothing: Colormap for multi-channel plotsdisplay_plot::Bool = true: Display the plot (true/false)error_bars::Symbol = :none: Error bars type to plot: :none, :sem, :within_sem, :ci95figure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titlehighlight_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)interactive::Bool = true: Enable interactive features (true/false)linestyle::Nothing = nothing: Line style for ERPs (single style or a vector of styles, one per dataset)linewidth::Nothing = nothing: Line width for ERPsplot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for plot titlesplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.scale_x_value::Nothing = nothing: X-axis scale value/step size (e.g. 0.1 for 100 ms)scale_y_value::Nothing = nothing: Y-axis scale value/step size (e.g. 5.0 for 5 μV)selection_alpha::Float64 = 0.3: Alpha (transparency) for interactive selection rectanglesselection_color::Symbol = :blue: Color for interactive selection rectanglestheme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for x-axis display (😒 or :ms). Only affects axis labels and tick formatting — all intervals remain in seconds.window_title::String = "": Title for the OS plot window. If empty, it's generated automatically.xgrid::Bool = false: Show x-axis grid (true/false)xlabel::String = "Time (s)": Label for x-axisxlim::Nothing = nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool = false: Show x-axis minor grid (true/false)xticks::Nothing = nothing: X-axis tick positions (e.g., -0.1:0.1:0.8 or [0, 0.2, 0.4]). If nothing, automatically determinedygrid::Bool = false: Show y-axis grid (true/false)ylabel::String = "μV": Label for y-axisylim::Nothing = nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedyminorgrid::Bool = false: Show y-axis minor grid (true/false)yreversed::Bool = false: Whether to reverse the y-axisyticks::Nothing = nothing: Y-axis tick positions (e.g., -4:2:4 or [-2, 0, 2]). If nothing, automatically determinedzoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Layout Options
layout_kwargs::@NamedTuple{} = NamedTuple(): Additional parameters to configure grid or topographical layouts (e.g., grid_dims, topo_plot_width, grid_rowgap)
Legend Options
legend::Bool = true: Show the legend (true/false)legend_channel::Vector{Any} = Any[]: Which channel to put the legend on.legend_label::String = "": Title for the legendlegend_nbanks::Nothing = nothing: Number of legend columns.legend_position::Symbol = :lt: Legend position (:lt, :rt, :lb, :rb, or tuple like (:left, :top), or (0.5, 0.5))
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
color::Nothing = nothing: Color for response curvesdisplay_plot::Bool = true: Whether to display the plotlabel_fontsize::Int64 = 22: Font size for axis labelslinewidth::Int64 = 4: Line width for response curvesn_points::Int64 = 2000: Number of frequency points for response calculationplot_title::String = "Filter Frequency Response": Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 24: Font size for titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.reference_color::Symbol = :gray: Color for reference linesreference_lines::Vector{Int64} = [-3, -6]: Reference lines in dB to displayreference_linestyle::Symbol = :dash: Line style for reference linestick_fontsize::Int64 = 20: Font size for tick labelsxgrid::Bool = false: Whether to show x-axis gridxlabel::String = "Frequency (Hz)": X-axis labelxlim::Nothing = nothing: X-axis limits in Hz as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool = false: Whether to show x-axis minor gridxscale::Makie.Symlog10{Makie.ReversibleScale{Makie.var"#forward#1209"{Int64, Float64, Float64}, Makie.var"#inverse#1210"{Int64, Float64, Float64}, IntervalSets.OpenInterval{Float32}}} = Symlog10(-10.0, 10.0; linscale = 1.0): X-axis scale typeygrid::Bool = false: Whether to show y-axis gridylabel::String = "Magnitude (dB)": Y-axis labelylim::Tuple{Int64, Int64} = (-100, 5): Y-axis limits in dB as (min, max) tupleyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Returns
fig: Makie Figure objectax: Tuple of Makie Axis objects (dB, impulse)
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.
General Plot Settings
add_x_origin::Bool = true: Whether to add vertical line at x=0color::Nothing = nothing: Color for tracesdisplay_plot::Bool = true: Whether to display the plotlinestyle::Nothing = nothing: Line style for traceslinewidth::Int64 = 2: Line width for GFP/dissimilarity tracesplot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for plot titlesplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.show_dissimilarity::Bool = false: Whether to include Global Dissimilarity panelshow_erp_traces::Bool = false: Whether to show individual ERP channel traces in top panelxgrid::Bool = false: Whether to show x-axis gridxlabel::String = "Time (s)": Label for x-axisxlim::Nothing = nothing: X-axis limits as (min, max) tuple. If nothing, automatically determinedxminorgrid::Bool = false: Whether to show x-axis minor gridygrid::Bool = false: Whether to show y-axis gridylabel::Nothing = nothing: Label for y-axis (auto-determined based on normalize flag)ylim::Nothing = nothing: Y-axis limits as (min, max) tuple. If nothing, automatically determinedyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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_final.jld2")
plot_gfp("erps_final")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_ica_component_spectrum Method
plot_ica_component_spectrum(data::ContinuousData, ica::InfoIca, components::Union{Int,Vector{Int}})Plot the power spectrum of specified ICA components.
sourceEegFun.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.
General Plot Settings
bar_alpha::Float64 = 0.7: Transparency of barsbar_color::Symbol = :steelblue: Color of the barsbar_width::Float64 = 0.8: Width of barsdisplay_plot::Bool = true: Whether to display the plotlabel_fontsize::Int64 = 14: Font size for axis labelsplot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.sort_values::Bool = false: If true, sort the bars by joint probability values in descending ordertick_fontsize::Int64 = 12: Font size for tick labelsxgrid::Bool = true: Whether to show x-axis gridxlabel::String = "Electrode": Label for x-axisxminorgrid::Bool = false: Whether to show x-axis minor gridxtick_rotation::Float64 = 0.7853981633974483: Rotation angle for x-axis tick labelsygrid::Bool = true: Whether to show y-axis gridylabel::String = "Joint Probability": Label for y-axisyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
bar_alpha::Float64 = 0.7: Transparency of barsbar_color::Symbol = :steelblue: Color of the barsbar_width::Float64 = 0.8: Width of barsdisplay_plot::Bool = true: Whether to display the plotlabel_fontsize::Int64 = 14: Font size for axis labelsplot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.sort_values::Bool = false: If true, sort the bars by joint probability values in descending ordertick_fontsize::Int64 = 12: Font size for tick labelsxgrid::Bool = true: Whether to show x-axis gridxlabel::String = "Electrode": Label for x-axisxminorgrid::Bool = false: Whether to show x-axis minor gridxtick_rotation::Float64 = 0.7853981633974483: Rotation angle for x-axis tick labelsygrid::Bool = true: Whether to show y-axis gridylabel::String = "Joint Probability": Label for y-axisyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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! Method
plot_layout!(args...; kwargs...)Plot a 2D sensor layout in an existing Makie axis.
sourceEegFun.plot_layout Method
plot_layout(args...; kwargs...)
plot_layout!(args...; kwargs...)Aliases for plot_layout_2d and plot_layout_2d! to maintain backwards compatibility and consistency with plot_topography (which is 2D by default).
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.
General Plot Settings
head_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Int64 = 1: Radius of the head shape (normalized units).
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
label_align::Tuple{Symbol, Symbol} = (:left, :bottom): Text alignment for electrode labels (e.g., (:center, :center)).label_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.label_zoffset::Int64 = 0: Z-axis offset for electrode labels (3D only).
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
head_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Int64 = 1: Radius of the head shape (normalized units).
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
label_align::Tuple{Symbol, Symbol} = (:left, :bottom): Text alignment for electrode labels (e.g., (:center, :center)).label_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.label_zoffset::Int64 = 0: Z-axis offset for electrode labels (3D only).
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
head_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Int64 = 1: Radius of the head shape (normalized units).
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
label_align::Tuple{Symbol, Symbol} = (:left, :bottom): Text alignment for electrode labels (e.g., (:center, :center)).label_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.label_zoffset::Int64 = 0: Z-axis offset for electrode labels (3D only).
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
head_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Int64 = 1: Radius of the head shape (normalized units).
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
label_align::Tuple{Symbol, Symbol} = (:left, :bottom): Text alignment for electrode labels (e.g., (:center, :center)).label_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.label_zoffset::Int64 = 0: Z-axis offset for electrode labels (3D only).
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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_stat_heatmap Method
plot_stat_heatmap(result::StatsResult; kwargs...)Plots a 2D heatmap of the t-statistics (Channels x Time).
sourceEegFun.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.
General Plot Settings
baseline_method::Symbol = :db: Baseline correction method: :db, :absolute, :relative, :relchange, :percent, :zscorecolorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::Nothing = nothing: Custom colorbar label. If nothing, automatically determinedcolorbar_plot::Bool = true: Whether to show the colorbarcolorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the heatmapcolorrange::Nothing = nothing: Color range as (min, max) tuple. If nothing, automatically determined from datadisplay_plot::Bool = true: Whether to display the plotfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)interpolate::Bool = false: Whether to interpolate the heatmap for a smoother appearancelayout::Symbol = :single: Layout type: :single, :grid, or :topoplot_title::Nothing = nothing: Plot title. If nothing, automatically determined from condition name and channelplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for plot titlesplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.theme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for x-axis display (😒 or :ms). Only affects axis labels and tick formatting — all intervals remain in seconds.xlim::Nothing = nothing: X-axis time limits as (min, max) tuple in seconds. If nothing, shows all time pointsxticks::Nothing = nothing: Custom x-axis ticks (e.g., -0.2:0.2:1.0)ylogscale::Bool = false: Whether to use logarithmic scale for the frequency (y) axisyticks::Nothing = nothing: Custom y-axis ticks (e.g., [2, 10, 20, 40, 80])
Layout Options
layout_kwargs::@NamedTuple{} = NamedTuple(): Additional parameters to configure grid or topographical layouts (e.g., grid_dims, topo_plot_width, grid_rowgap)
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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 = nothing,
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.
General Plot Settings
colorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::String = "": Label for the colorbarcolorbar_plot::Bool = true: Whether to show the colorbarcolorbar_plot_numbers::Vector{Any} = Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the topographycomponent_selection::EegFun.var"#components##0#components##1" = EegFun.var"#components##0#components##1"(): Function that returns boolean vector for component filteringdims::Nothing = nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish griddisplay_plot::Bool = true: Whether to display the plotfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titlegridscale::Int64 = 75: Grid resolution for interpolationhead_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Float64 = 1.0: Radius of the head shape in mm.highlight_channels::Nothing = nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)interactive::Bool = true: Whether to enable interactive featureslabel_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.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.num_levels::Int64 = 20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.plot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for the titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.theme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.use_global_scale::Bool = false: Do multiple ICA topoplots share the same color scale based on min/max across all components?ylim::Nothing = nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.zoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
colorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::String = "": Label for the colorbarcolorbar_plot::Bool = true: Whether to show the colorbarcolorbar_plot_numbers::Vector{Any} = Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the topographycomponent_selection::EegFun.var"#components##0#components##1" = EegFun.var"#components##0#components##1"(): Function that returns boolean vector for component filteringdims::Nothing = nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish griddisplay_plot::Bool = true: Whether to display the plotfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titlegridscale::Int64 = 75: Grid resolution for interpolationhead_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Float64 = 1.0: Radius of the head shape in mm.highlight_channels::Nothing = nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)interactive::Bool = true: Whether to enable interactive featureslabel_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.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.num_levels::Int64 = 20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.plot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for the titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.theme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.use_global_scale::Bool = false: Do multiple ICA topoplots share the same color scale based on min/max across all components?ylim::Nothing = nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.zoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
colorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::String = "": Label for the colorbarcolorbar_plot::Bool = true: Whether to show the colorbarcolorbar_plot_numbers::Vector{Any} = Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the topographycomponent_selection::EegFun.var"#components##0#components##1" = EegFun.var"#components##0#components##1"(): Function that returns boolean vector for component filteringdims::Nothing = nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish griddisplay_plot::Bool = true: Whether to display the plotfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titlegridscale::Int64 = 75: Grid resolution for interpolationhead_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Float64 = 1.0: Radius of the head shape in mm.highlight_channels::Nothing = nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)interactive::Bool = true: Whether to enable interactive featureslabel_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.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.num_levels::Int64 = 20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.plot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for the titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.theme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.use_global_scale::Bool = false: Do multiple ICA topoplots share the same color scale based on min/max across all components?ylim::Nothing = nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.zoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
Examples
plot_topography("grand_average_erps_final.jld2")
plot_topography("erps_final")
plot_topography("erps_final", 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_3d Method
plot_topography_3d(dat::MultiDataFrameEeg, epoch::Int; kwargs...)Create a 3D topographic plot for a specific epoch of MultiDataFrameEeg data.
EegFun.plot_topography_3d Method
plot_topography_3d(dat::SingleDataFrameEeg; kwargs...)Plot a perfectly smooth 3D interpolation of EEG data mapped onto a realistically proportioned head mesh.
Keyword Arguments
All keyword arguments below have sensible defaults. You can override any by passing the corresponding keyword argument.
General Plot Settings
camera_azimuth::Nothing = nothing: Initial camera azimuth angle (degrees) for 3D plots. (nothing for auto)camera_elevation::Nothing = nothing: Initial camera elevation angle (degrees) for 3D plots. (nothing for auto)colorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::String = "": Label for the colorbarcolorbar_plot::Bool = true: Whether to show the colorbarcolorbar_plot_numbers::Vector{Any} = Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the topographycomponent_selection::EegFun.var"#components##0#components##1" = EegFun.var"#components##0#components##1"(): Function that returns boolean vector for component filteringdims::Nothing = nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish griddisplay_plot::Bool = true: Whether to display the plotfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titlegridscale::Int64 = 75: Grid resolution for interpolationhead_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Float64 = 1.0: Radius of the head shape in mm.highlight_channels::Nothing = nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)interactive::Bool = true: Whether to enable interactive featureslabel_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.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.num_levels::Int64 = 20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.plot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for the titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.theme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.use_global_scale::Bool = false: Do multiple ICA topoplots share the same color scale based on min/max across all components?ylim::Nothing = nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.zoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
sourceFurther Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
colorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::String = "": Label for the colorbarcolorbar_plot::Bool = true: Whether to show the colorbarcolorbar_plot_numbers::Vector{Any} = Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the topographycomponent_selection::EegFun.var"#components##0#components##1" = EegFun.var"#components##0#components##1"(): Function that returns boolean vector for component filteringdims::Nothing = nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish griddisplay_plot::Bool = true: Whether to display the plotfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titlegridscale::Int64 = 75: Grid resolution for interpolationhead_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Float64 = 1.0: Radius of the head shape in mm.highlight_channels::Nothing = nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)interactive::Bool = true: Whether to enable interactive featureslabel_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.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.num_levels::Int64 = 20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.plot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for the titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.theme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.use_global_scale::Bool = false: Do multiple ICA topoplots share the same color scale based on min/max across all components?ylim::Nothing = nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.zoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
colorbar_kwargs::@NamedTuple{} = NamedTuple(): Additional kwargs passed directly to the Makie Colorbar block (see Makie's Colorbar documentation for available attributes).colorbar_label::String = "": Label for the colorbarcolorbar_plot::Bool = true: Whether to show the colorbarcolorbar_plot_numbers::Vector{Any} = Any[]: Plot indices for which to show colorbars. Empty list shows colorbars for all plots.colorbar_position::Symbol = :right: Position of the colorbar (:right, :left, :top, :bottom, or tuple)colormap::Nothing = nothing: Colormap for the topographycomponent_selection::EegFun.var"#components##0#components##1" = EegFun.var"#components##0#components##1"(): Function that returns boolean vector for component filteringdims::Nothing = nothing: Grid dimensions (rows, cols). If nothing, calculates best square-ish griddisplay_plot::Bool = true: Whether to display the plotfigure_padding::NTuple{4, Int64} = (10, 30, 10, 10): Padding around entire figure as (left, right, bottom, top) tuple (in pixels)figure_title::String = "": Title drawn at the top of the entire figure canvasfigure_title_fontsize::Int64 = 24: Font size for figure titlegridscale::Int64 = 75: Grid resolution for interpolationhead_color::Nothing = nothing: Color of the head shape outline.head_linewidth::Int64 = 2: Line width of the head shape outline.head_radius::Float64 = 1.0: Radius of the head shape in mm.highlight_channels::Nothing = nothing: Highlight channel groups as a NamedTuple or Vector of NamedTuples. Each group: (channels=[:Cz, :Pz], color=:white, size=8, marker=:circle)interactive::Bool = true: Whether to enable interactive featureslabel_color::Nothing = nothing: Color of electrode labels.label_fontsize::Int64 = 20: Font size for electrode labels.label_plot::Bool = true: Whether to plot electrode labels.label_xoffset::Int64 = 0: X-axis offset for electrode labels.label_yoffset::Int64 = 0: Y-axis offset for electrode labels.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.num_levels::Int64 = 20: Number of contour levels (for ICA plots). For standard plots, use ylim instead.plot_title::Nothing = nothing: Plot titleplot_title_align::Tuple{Symbol, Symbol} = (:center, :top): Alignment of the inner plot titleplot_title_fontsize::Int64 = 16: Font size for the titleplot_title_position::Nothing = nothing: Relative (x, y) coordinates for the plot title (e.g., (0.5, 0.95)). If provided, the title is drawn inside the axis.point_color::Nothing = nothing: Color of electrode points.point_marker::Symbol = :circle: Marker style for electrode points.point_markersize::Int64 = 12: Size of electrode point markers.point_plot::Bool = true: Whether to plot electrode points.theme_fontsize::Nothing = nothing: Font size for themetime_unit::Symbol = :s: Time unit for display labels (😒 or :ms). Only affects title strings — all intervals and selections remain in seconds.use_global_scale::Bool = false: Do multiple ICA topoplots share the same color scale based on min/max across all components?ylim::Nothing = nothing: Y-axis limits (nothing for auto). For ICA plots, use num_levels instead.zoom_step::Float64 = 0.2: Fractional zoom step for arrow keys (e.g. 0.2 means 20% zoom in/out)
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
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.font_size::Int64 = 24: Font size for text elements.ignore_triggers::Vector{Int64} = Int64[]: Vector of trigger codes to ignore.initial_position::Float64 = -2.0: Initial position of the time interval in seconds.label_fontsize::Int64 = 20: Font size for labels.line_offset::Float64 = 0.1: Offset for trigger vertical lines.linewidth_trigger::Int64 = 1: Line width for trigger vertical lines.marker_size::Int64 = 15: Size of markers in the trigger overview plot.max_window_size::Float64 = 100.0: Maximum size of the time interval in seconds.min_window_size::Float64 = 0.1: Minimum size of the time interval in seconds.position_step::Float64 = 0.5: Step size for position slider.time_label_offset::Float64 = -0.001: Vertical offset for time labels.timeline_width::Int64 = 2: Line width for the main timeline.window_size::Float64 = 10.0: Size of the time window to display in seconds.window_size_step::Float64 = 1.0: Step size for window size slider.xgrid::Bool = false: Whether to show x-axis gridxminorgrid::Bool = false: Whether to show x-axis minor gridy_max_limit::Float64 = 0.15: Maximum y-axis limit.y_min_limit::Float64 = -0.1: Minimum y-axis limit.ygrid::Bool = false: Whether to show y-axis gridyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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.
General Plot Settings
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.font_size::Int64 = 24: Font size for text elements.ignore_triggers::Vector{Int64} = Int64[]: Vector of trigger codes to ignore.initial_position::Float64 = -2.0: Initial position of the time interval in seconds.label_fontsize::Int64 = 20: Font size for labels.line_offset::Float64 = 0.1: Offset for trigger vertical lines.linewidth_trigger::Int64 = 1: Line width for trigger vertical lines.marker_size::Int64 = 15: Size of markers in the trigger overview plot.max_window_size::Float64 = 100.0: Maximum size of the time interval in seconds.min_window_size::Float64 = 0.1: Minimum size of the time interval in seconds.position_step::Float64 = 0.5: Step size for position slider.time_label_offset::Float64 = -0.001: Vertical offset for time labels.timeline_width::Int64 = 2: Line width for the main timeline.window_size::Float64 = 10.0: Size of the time window to display in seconds.window_size_step::Float64 = 1.0: Step size for window size slider.xgrid::Bool = false: Whether to show x-axis gridxminorgrid::Bool = false: Whether to show x-axis minor gridy_max_limit::Float64 = 0.15: Maximum y-axis limit.y_min_limit::Float64 = -0.1: Minimum y-axis limit.ygrid::Bool = false: Whether to show y-axis gridyminorgrid::Bool = false: Whether to show y-axis minor grid
Further Legend Options
EegFun.jlpasses any argument prefixed withlegend_directly to Makie's legend system. While only the most common options are listed above, you can pass any standard Makie legend attribute (e.g.,legend_bgcolor,legend_patchsize). See the Makie.jl documentation for a full list of discoverable arguments.
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])