plotMap: Plot scalp topographies

Description Usage Arguments Value See Also Examples

View source: R/plots.R

Description

plotMap takes an array (or a vector) of ERP amplitudes and plots scalp topographies at user-defined time points.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plotMap(
  dat,
  chan_pos,
  topo_time = NULL,
  subset = list(),
  aspect_ratio = NULL,
  ampl_range = NULL,
  map_marker_colour = "grey10",
  map_marker_shape = "|",
  map_marker_size = 1.2,
  ...
)

Arguments

dat

either a numeric vector or a numeric array of ERP amplitudes. If 'dat' is a named vector, its names are taken as channel names. If unnamed, the order of the data must correspond to the order of channels in 'chan_pos'. If 'dat' is an array, it must have at least 'time' and 'chan' dimensions.

chan_pos

a data.frame of channel positions. Obligatory if topo_time is not NULL.

topo_time

[optional] an object which describes the time points at which the scalp topographies should be plotted. Can be a simple atomic vector or a data.frame if the time points are not identical across the faceting dimension(s).

subset

a named list to subset the input arrays; see subsetArray

aspect_ratio

the ratio of y and x axes on the figure. If NULL (the default), it is set automatically. A user-defined 'aspect_ratio' might be adjusted to avoid overlapping scalp maps.

ampl_range

the range of amplitudes to plot. If NULL (default), it is computed from the data.

map_marker_colour

the colour, shape, and size of the marker used to mark the exact time points of the maps

map_marker_shape

the colour, shape, and size of the marker used to mark the exact time points of the maps

map_marker_size

the colour, shape, and size of the marker used to mark the exact time points of the maps

...

additional arguments passed to topoCoord

Value

plotMap returns a ggplot object.

See Also

plotButterfly for a more complex way of visualizaton

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# load example data
data(erps)

# extract channel positions
chan_pos <- attr(erps, "chan")

# collapse pairtypes and participants
tempdat <- avgDims(erps, c("pairtype", "id"))

# plot topo-maps of stimclass differences from 0 to 500 in 50 ms steps
map <- plotMap(compareLevels(tempdat, "stimclass"),
               topo_time = seq(0, 500, by = 50),
               chan_pos = chan_pos)

# add title
library(ggplot2)
map + ggtitle("Pairwise differences between stimulus classes")
         

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