usingNeuroAnalyzerusingCairoMakieCairoMakie.activate!(type="png")# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of# NeuroAnalyzer figures: remove itdelete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)NeuroAnalyzer.progress_bar =false# EEG channels onlyeeg =load_neuro("files/eeg/eeg.hdf")eeg =keep_channel(eeg; ch ="eeg")
NeuroAnalyzer plotting functions return Makie figures (GLMakie.Figure), which can be combined into one figure.
Tip: functions that open an interactive window by default (e.g. NeuroAnalyzer.plot(), plot_locs()) must be called with gui = false to return a static figure.
Composing Plots
plot_compose() arranges a vector of figures in a grid (rows, columns); empty cells are added if there are fewer figures than cells:
All figures are placed in cells of the size of the largest figure, so for best results they should have the same size.
Custom Layouts
For other layouts, a figure can be rendered to an image and placed in any cell of a Makie grid layout, e.g. a signal over the whole width and two smaller plots below it:
# draw figure f (rendered to an image) in the grid position posfunctionplace!(pos, f) ax =Axis(pos; aspect =DataAspect(), yreversed =true)image!(ax, permutedims(Makie.colorbuffer(f)))hidedecorations!(ax)hidespines!(ax)returnnothingendp3 =plot_locs(eeg; ch ="eeg", sch ="O1", gui =false)fig =Figure(size = (1200, 1000))place!(fig[1, 1:2], p1)place!(fig[2, 1], p2)place!(fig[2, 2], p3)fig
A figure can also be added as an inset to another figure using add_inset() (see the channel locations tutorial).
Tiled Plots
A tiled plot of the auto-covariance of several channels. First, the data:
ac =acov(eeg; ch ="eeg", l =50)l =labels(eeg)size(ac.autocov)
(19, 101, 1)
Next, a vector of plots:
p = [plot_xac(ac.autocov[idx, :, 1], ac.lags; title = l[idx]) for idx in1:8]