eegspace: Plots Multi-Channel EEG Spatial Map

Description Usage Arguments Value Note Author(s) References Examples

Description

Creates plot of multi-channel electroencephalography (EEG) spatial map. User can control the plot type (2d or 3d), the colormap, color, etc.

Usage

1
2
3
4
5
6
eegspace(space, voltage, vlim = NULL, mycolors = NULL, ncolor = 25,
         colorbar = TRUE, nctick = 5, rtick = 1, cex.axis = 1,
         barloc = NULL, colorlab = NULL, colorlabline = 3, cex.lab = 1,
         plotaxes = FALSE, main = "", xyzlab = NULL, cex.point = 1,
         cex.main = 1, nose = TRUE, ears = TRUE, head = TRUE,
         col.head = "AntiqueWhite", mar = NULL, ...)

Arguments

space

Matrix of input electrode coordinates (3d or 2d).

voltage

Vector of recorded EEG voltage at each row in space.

vlim

Two-element vector giving the limits to use when mapping voltage to colors in mycolors. Default is vlim=range(voltage).

mycolors

Character vector of colors to use for color mapping (such that length(mycolors)<=ncolor). Default: mycolors=c("blueviolet","blue","cyan","green","yellow","orange","red").

ncolor

Number of colors to use in mapping (positive integer).

colorbar

If TRUE, colorbar is plotted.

nctick

Approximate number of ticks for colorbar. Ignored if colorbar=FALSE.

rtick

Round tick labels to given decimal. Ignored if colorbar=FALSE.

cex.axis

Cex of axis ticks for colorbar. Ignored if colorbar=FALSE.

barloc

Character vector giving location of color bar. See Notes.

colorlab

Character vector giving label for color bar. Ignored if colorbar=FALSE.

colorlabline

Line number for color bar label (for input to mtext).

cex.lab

Cex of axis labels for colorbar. Ignored if colorbar=FALSE.

plotaxes

If TRUE, axes labels are plotted. Ignored for 3d plots.

main

Plot title. 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

Cex for plotted electrodes.

cex.main

Cex for plot title. Ignored if main=NULL.

nose

If TRUE, triangle is plotted to represent the subject's nose. Ignored if ncol(space)==3.

ears

If TRUE, ovals are plotted to represent the subject's ears. Ignored if ncol(space)==3.

head

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

col.head

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

mar

Margins to use for plot (see par).

...

Optional inputs for plot or lines function.

Value

Produces plot of EEG spatial map with NULL return value.

Note

For 3d plots, barloc can be one of four options: "backright", "backleft", "frontright", or "frontleft". For 2d plots, barloc can be either "right" or "left".

Currently supports spatial maps registered to the 84-channel cap produced by eegcap and eegcoord.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

References

Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.

Begleiter, H. Neurodynamics Laboratory. State University of New York Health Center at Brooklyn. http://www.downstate.edu/hbnl/

Ingber, L. (1997). Statistical mechanics of neocortical interactions: Canonical momenta indicatros of electroencephalography. Physical Review E, 55, 4578-4593.

Ingber, L. (1998). Statistical mechanics of neocortical interactions: Training and testing canonical momenta indicators of EEG. Mathematical Computer Modelling, 27, 33-64.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
##########   EXAMPLE   ##########

# get time point 65 (approx 250 ms) from "eegdata" data
data(eegdata)
idx <- which(eegdata$time==65L)
eegdata <- eegdata[idx,]

# get average spatial map
eegmean <- tapply(eegdata$voltage,list(eegdata$channel,eegdata$group),mean)

# remove ears and nose
acnames <- rownames(eegmean)
idx <- c(which(acnames=="X"),which(acnames=="Y"),which(acnames=="nd"),which(acnames=="Cz"))
eegmean <- eegmean[-idx,]

# match to eeg coordinates
data(eegcoord)
cidx <- match(rownames(eegmean),rownames(eegcoord))

# # plot average control voltage in 3d
# open3d()
# eegspace(eegcoord[cidx,1:3],eegmean[,2])

# plot average control voltage in 2d
eegspace(eegcoord[cidx,4:5],eegmean[,2])

# # change 3d bar location and use play3d to rotate (not run)
# open3d()
# par3d(windowRect=c(0,0,600,600))
# eegspace(eegcoord[cidx,1:3],eegmean[,2],barloc="frontleft")
# play3d(spin3d(axis=c(0,0,1),rpm=5),duration=20)

# change 2d bar location
eegspace(eegcoord[cidx,4:5],eegmean[,2],barloc="left")

eegkit documentation built on May 1, 2019, 8:02 p.m.