Learn R Programming

erpR (version 0.2.0)

topoplot: plot a topographic map of ERP

Description

Plot a topographic map of an ERP on a specific timepoint or averaging the ERP in a time window. The head is represented as a circle.

Usage

topoplot(erpobj, startmsec=-200, endmsec=1200, win.ini, win.end, exclude = NULL, elec.coord=NULL, projection="orthographic", palette.col="jet", palette.steps=10, return.coord = FALSE, zlim=NULL, interpolation = "cubicspline", extrap = TRUE, interp.points = 500, return.notfound=FALSE, mask = TRUE, contour=TRUE, x.rev=FALSE, draw.elec.pos=TRUE, draw.nose=FALSE, draw.elec.lab=TRUE, elec.lab.adj=c(0.5, NA), head.col="black", head.lwd=1, ...)

Arguments

erpobj
an ERP dataframe with electrodes in columns and timepoints in rows.
startmsec
start time (in ms) of the ERP data frame. It can be a negative value, indicating the baseline time frame.
endmsec
end time (in ms) of the ERP data frame.
win.ini
the initial edge (in ms) of the window on which the topographic map has to be plotted.
win.end
the final edge (in ms) of the window on which the topographic map has to be plotted. If equal to win.ini, then the map of a single time point is plotted.
exclude
a vector of characters indicating the channel names that are excluded from the plotting
elec.coord
an optional data frame with electrode coordinates (see Note).
projection
the type of electrode projection from 3d to 2d. Two methods available are "orthographic" and "equalarea".
palette.col
the color palette. Two default palettes are available: "jet" or "heat". Otherwise a customized palette can be created. A palette will be built as an interpolation trough the vector of colors provided.
palette.steps
the number of steps in the color palette.
return.coord
if TRUE, the function doesn't create a topoplot, but returns a data frame containing all the built-in electrode coordinates.
zlim
the limits of z axis (i.e. colors in the topographic map). If NULL, then the limits are automatically computed.
interpolation
The interpolation between electrodes. Two methods from package akima are available: "linear" and "cubicspline".
extrap
logical. Extrapolate the data outside the convex hull also. This parameter is ignored if interpolation method is "linear".
interp.points
the number of points to be used for interpolation. This parameter defines the smoothness of the plot.
return.notfound
logical. If TRUE, the function doesn't create a topoplot, but returns a vector with the electrode names in erpobj not contained in the supplied list of electrodes.
mask
logical. Should a circular mask around topographic map be drawn?
contour
logical. Should contour lines be drawn?
x.rev
logical. Should the x axis be reversed?
draw.elec.pos
logical. Should the black points be drawn in correspondence with electrode positions?
draw.nose
logical. Should a nose be drawn to indicate upper side of the mask?
draw.elec.lab
logical. Should electrode labels be drawn?
elec.lab.adj
a vector with a pair of values indicating horizontal and vertical adjustment of electrode labels (see text).
head.col
line color of head and nose.
head.lwd
line width of head and nose.
...
further parameters to be passed to image.

Value

The topographic map is plotted. The function also returns a list of values that can be used by other functions. The first item of the list is a pair of values indicating the zlim of the plot. The second item of the list is a vector indicating the palette created by the function (palette). This last vector with palette colors can be used by the topoplot.palette function.

Examples

Run this code

if(require(akima)){

data(ERPsets)

word=grandaverage("Exp1_word_subj", 1:20, erplist=ERPsets)

# check if some electrodes are not present in the list 
# and create an object with these electrode names.

notfound=topoplot(word, return.notfound=TRUE)

#make a topoplot excluding not found electrode
topoplot(word, startmsec=-200, endmsec=1500, win.ini=400,
win.end=600, exclude=notfound)
}

Run the code above in your browser using DataLab