
Interactive 3D surface topographic plot of EEG signal
interactive_surfaceplot.RdCreates an interactive 3D mesh surface plot of EEG amplitude in one time point using plotly.
The dense point mesh forms the 2D base, while the interpolated signal amplitude determines the 3D elevation and surface color.
Usage
interactive_surfaceplot(
data,
amplitude,
mesh,
coords = NULL,
template = NULL,
col_range = NULL,
col_scale = NULL,
show_sensors = TRUE
)Arguments
- data
A data frame, tibble, or a database table with input data to plot. It must contain at least two columns:
sensorwith sensor labels, and the column with the EEG amplitude specified in the argumentamplitude.- amplitude
A character string specifying the name of the column from the input data containing EEG amplitude values.
- mesh
A
"mesh"object (or a named list with the same structure) containing at least aD2element with x and y coordinates of a point mesh used for computing the IM model, and atemplateelement specifying the sensor montage. If not defined, the point mesh with default settings frompoint_meshfunction is used.- coords
Sensor coordinates as a tibble or data frame with named
x,yandsensorcolumns. Thesensorlabels must match the labels in sensor column indata. If not defined, the template specified inmesh$template(or the default"HCGSN256") is used.- template
The kind of sensor template montage used. Available options are
"HCGSN256","biosemi128","biosemi256", and"system1005". Default setting is"HCGSN256".- col_range
A vector with minimum and maximum value of the amplitude used in the colour palette for plotting. If not defined, the range of interpolated signal is used.
- col_scale
Optionally, a colour scale to be utilised for plotting. If not defined, it is computed from
col_range.- show_sensors
Logical. Indicates whether original sensor locations should be visualized as black scatter points on the 3D surface. Default is
TRUE.
Value
A plotly widget object containing the interactive 3D surface plot.
Additionally, the returned object carries a "diegr_metadata" attribute with metadata such as details about the data and plot.
Examples
# \donttest{
# Prepare a data structure:
edata <- pick_data(epochdata, subject_rg = 2, epoch_rg = 1:13, time_rg = 1:10)
data_base <- baseline_correction(edata, baseline_range = 1:9)
data_mean <- compute_mean(data_base, amplitude = "signal_base", type = "point", domain = "space")
# Create an interactive 3D surface plot of average signal in time point 10:
data_mean |>
dplyr::filter(time == 10) |>
interactive_surfaceplot(amplitude = "average", col_range = c(-10, 10))
# }