plot2dview: Plot the topography of the signals

Description Usage Arguments Examples

View source: R/plots.R

Description

plot2dview creates 2D topoplots

Usage

 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
plot2dview(
  dat,
  ch_pos,
  r = 1,
  timepoint = NULL,
  ampl_range = NULL,
  type = c("contour", "raster"),
  resol = 30L,
  resolcol = 101L,
  projection = "laea",
  projref = c("pole", "equator"),
  origo = c(lat = ifelse(projref == "pole", 90, 0), long = ifelse(projref == "pole",
    270, 0)),
  plot_centroid = TRUE,
  centroid_circle = 0.5,
  centroid_unitsphere = FALSE,
  plot_bar = TRUE,
  plot_ch = TRUE,
  plot_chnames = TRUE,
  title = NULL,
  gfp = NULL,
  gfp_max = NULL,
  colour_scale = function(n) gplots::colorpanel(n, "blue", "white", "red"),
  colour_midpoint = 0,
  ...
)

Arguments

dat

a numeric vector or matrix. If a matrix is provided, it must contain the participants in rows and the channels in columns

ch_pos

a data.frame of electrode positions, see coordinates

r

a numeric value; the radius of the head (not used if ch_pos contains a column r)

timepoint

an integer value representing the time point at which the amplitude values were recorded. This is used as the title of the topoplot if the 'title' argument is not provided, and for highlighting the time point on the GFP curve if 'gfp' data are provided (with proper names or dimnames attribute).

ampl_range

numeric vector, the minimum and maximum value of the amplitudes. If NULL (default), it is computed from the data. Data values outside the ampl_range interval are winsorized (set to equal to the minimum or maximum limit).

type

the type of the topoplot, either "contour" (the default) or "raster". The latter is faster for very high resolution topoplots.

resol

integer value, the resolution of the projection locations for each axis (default: 30L)

resolcol

integer value, the number of levels for colouring (default: 101L)

projection

character value (default = "laea"). See http://www.remotesensing.org/geotiff/proj_list/ for common projections

projref

projection reference (pole [default] or equator)

origo

a named character vector of lat and long coordinates of the origo

plot_centroid

should centroids be plotted (default: TRUE)

centroid_circle

numeric scalar (default=0.5), the ratio of individual centroid coordinates which fall into the area of a shaded circle

centroid_unitsphere

should centroids be projected onto the 2d plane as if they were located on the surface of a unit sphere (default: false)

plot_bar

put color bar on the plot (default: TRUE)

plot_ch

plot channels as dots (default: TRUE)

plot_chnames

plot channel names (default: TRUE)

title

title of the plot

gfp

a numeric vector of the GFP values in the whole time window

gfp_max

the upper limit if gfp is provided

colour_scale

function which creates a colour scale with n values (n is defined by resolcol). The default is to use the colorpanel function, with blue > white > red colour scale.

colour_midpoint

a number to which the middle colour of the colour scale corresponds

...

arguments to chanInterp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# example data
data(erps)
chan_pos <- attr(erps, "chan")   # channel positions

# plot the grand average scalp distribution at 200 ms, for the stimulus 
# class "A" and pairtye "ident" condition; display also the GFP curve of the 
# whole epoch
plotdat <- transformArray(y ~ chan + time, erps,
                          subset = list(stimclass = "A", pairtype = "ident"),
                          datfr = FALSE)
gfpdat <- compGfp(plotdat)
plot2dview(subsetArray(plotdat, list(time = "200")),
           chan_pos, timepoint = 200, gfp = gfpdat)

tdeenes/eegR documentation built on April 19, 2021, 4:17 p.m.