| animate_topo_mean | R Documentation |
An animation of the average signal time course as a topographic map along with the lower and upper bounds of the confidence interval. In the output, three facets are plotted per frame: CI lower, average, CI upper.
animate_topo_mean(
data,
t_lim,
FS = 250,
t0 = 1,
mesh,
coords = NULL,
template = NULL,
col_range = NULL,
col_scale = NULL,
show_legend = TRUE,
contour = FALSE,
output_path = NULL,
...
)
data |
A data frame, tibble or a database table with input data to plot. It should be an output from |
t_lim |
Limits of time points (i.e., the length of the timeline displayed below the animation). |
FS |
The sampling frequency. Default value is 250 Hz. |
t0 |
Index of the zero time point, i.e. point, where 0 ms should be marked (most often time of the stimulus or time of the response). |
mesh |
A |
coords |
Sensor coordinates as a tibble or data frame with named |
template |
The kind of sensor template montage used. Currently the only available option is |
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 the input signal is used. |
col_scale |
Optionally, a colour scale to be utilised for plotting. If not defined, it is computed from |
show_legend |
Logical. Indicates, whether legend should be displayed below the graph. Default value is |
contour |
Logical. Indicates, whether contours should be plotted in the graph. Default value is |
output_path |
File path where the animation will be saved using |
... |
Additional parameters for animation according to gganimate::animate. |
Note: When specifying the coords and template at the same time, the template parameter takes precedence and the coords parameter is ignored.
If output_path is NULL, the function prints the animation to the RStudio Viewer.
If output_path is specified, the animation is saved to the given file path and not displayed. The gifski and magick packages are required for animation export.
animate_topo, compute_mean, baseline_correction
# This example may take a few seconds to render.
# Run only if you want to generate the full animation.
# a) prepare data: compute the mean from baseline corrected signal for subject 2,
# first 10 points and only 13 epochs (epochs 14 and 15 are outliers)
edata <- epochdata |>
dplyr::filter(subject == 2 & time %in% 1:10 & epoch %in% 1:13)
data_base <- baseline_correction(edata, baseline_range = 1:10) # baseline correction
data_mean <- compute_mean(data_base, amplitude = "signal_base", subject = 2,
type = "jack", group = "space") # compute mean
# b) render the animation
# (t0 = 10 because the time of the stimulus in epochdata is in time point 10)
animate_topo_mean(data_mean, t_lim = c(1,50), t0 = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.