Learn R Programming

eegkit (version 1.0-5)

eegcapdense: Draws Dense EEG Cap with Selected Electrodes

Description

Creates two- or three-dimensional plot of dense electroencephalography (EEG) cap that spans user-input electrodes. Three-dimensional plots are created using the eegdense data and the plot3d function (from rgl package). Currently supports 933 scalp electrodes. Includes customization options (e.g., each electrode can have a unique plotting color, size, label color, etc.).

Usage

eegcapdense(electrodes = "10-10", type = c("2d", "3d"),
            plotlabels = TRUE, plotaxes = FALSE, main = "",
            xyzlab = NULL, cex.point = NULL, col.point = NULL,
            cex.label = NULL, col.label = NULL, nose = TRUE,
            ears = TRUE, head = TRUE, col.head = "AntiqueWhite",
            index = FALSE, zconst = 0.5, plt = c(0.03,0.97,0.03,0.97), ...)

Value

Produces plot of EEG cap and possibly returns cap row indices.

Arguments

electrodes

Character vector with electrodes to plot. Each element of electrodes must match one of the 89 reference electrodes (see Notes). Mismatches are ignored (not plotted). Input is NOT case sensitive. Default plots all available electrodes (full 10-10 system).

type

Type of plot to create: type="3d" produces three-dimensional plot, whereas type="2d" produces two-dimensional projection plot (bird's eye view).

plotlabels

If TRUE, the electrode labels are plotted.

plotaxes

If TRUE, the axes are plotted.

main

Title to use for plot. Default is no title

xyzlab

Axis labels to use for plot. If type="2d", then xyzlab should be two-element character vector giving x and y axis labels. If type="3d", then xyzlab should be three-element character vector giving x, y, and z axis labels.

cex.point

Size of electrode points. Can have a unique size for each electrode.

col.point

Color of electrode points. Can have a unique color for each electrode.

cex.label

Size of electrode labels. Can have a unique size for each electrode label. Input is ignored if plotlabels=FALSE is used.

col.label

Color of electrode labels. Can have a unique color for each electrode label. Input is ignored if plotlabels=FALSE is used.

nose

If TRUE, triangle is plotted to represent the subject's nose. Ignored if type="3d".

ears

If TRUE, ovals are plotted to represent the subject's ears. Ignored if type="3d".

head

If TRUE, head is plotted. Ignored if type="2d".

col.head

Color for dummy head in 3d plot. Ignored if type="2d".

index

Logical indicating if the cap row indices should be returned (see Note).

zconst

Scalar controlling which row indices should be returned (see Note).

plt

A vector of the form c(x1, x2, y1, y2) giving the coordinates of the plot region as fractions of the current figure region. See par.

...

Optional inputs for plot or plot3d function.

Author

Nathaniel E. Helwig <helwig@umn.edu>

References

Murdoch, D., and Adler, D. (2025). rgl: 3D Visualization Using OpenGL. tools:::Rd_expr_doi("10.32614/CRAN.package.rgl"), R package version 1.3.18, http://CRAN.R-project.org/package=rgl

Oostenveld, R., and Praamstra, P. (2001). The Five percent electrode system for high-resolution EEG and ERP measurements. Clinical Neurophysiology, 112, 713-719. tools:::Rd_expr_doi("10.1016/S1388-2457(00)00527-7")

Examples

Run this code
##########   EXAMPLE 1   ##########

# plot 10-10 system (default):
eegcapdense()



##########   EXAMPLE 2   ##########

# plot 10-20 system:
eegcapdense("10-20", plotlabels = FALSE)



##########   EXAMPLE 3   ##########

# plot custom subset of electrodes
myelectrodes <- c("FP1","FP2","FPZ","F7","F3","FZ",
                  "F4","F8","T7","C3","CZ","C4","T8",
                  "P7","P3","PZ","P4","P8","O1","O2")
eegcapdense(myelectrodes)

Run the code above in your browser using DataLab