topoplot.palette: Add a palette to a plot

Description Usage Arguments Value Note Author(s) Examples

Description

This function draws a topoplot palette as a rectangle with colored areas indicating the palette shades.

Usage

1
2
3
4
topoplot.palette(cols, pos = c(0.5,0.5), p.width=0.2, p.height=0.8, 
horizontal = FALSE, rev= FALSE, palette.lwd=2, palette.bord="black", 
palette.lim = c(-5,5), draw.labels=TRUE, lab.dist = 1, lab.cex = 1,
 lab.font = 1, lab.family = "", measure = "microvolts", detailed.labels = NULL)

Arguments

cols

a vector of colors to draw the palette. This vector may be the output of topoplot.

pos

the position of the palette as a proportion of the plot region. Default (c(0.5, 0.5)) is centered on the screen.

p.width

palette width as a proportion of the plot region.

p.height

palette height as a proportion of the plot region.

horizontal

logical. Should the color shades be plotted horizontally? (default is vertical)

rev

logical. Should the palette shades order be reversed?

palette.lwd

line width of the palette rectangle.

palette.bord

color of the palette border.

palette.lim

limits of the palette. They will be plotted as text if labels=TRUE.

draw.labels

logical. Should labels be drawn?

labels

logical. Should labels indicating zlim be drawn?

lab.dist

a number indicating the distance of the labels from the palette rectangle. Positive numbers move the labels from the palette rectangle, whereas negative numbers move the labels towards the rectangle.

lab.cex

magnification factor for the labels.

lab.font

font type for the labels (see par).

lab.family

font family for the labels (see par).

measure

the label indicating the labels to be displayed with the palette. Default is "microvolt" and an expression with microvolt label is added. Otherwise you can specify any text string (e.g., "%").

detailed.labels

a list containing two labels, for the upper and lower limits of the palette (e.g. list(10 "%", "-10%"). If specified this value overrides measure argument. NOTE that if you use this argument you must manually specify the numeric value of the limits (the same of zlim).

Value

the function draws a palette on an existing plot.

Note

The two parameters cols and zlim may be supplied with values that are returned from topoplot.

Author(s)

Giorgio Arcara

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
	
if(require(akima)) {

data(erplistExample)

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

# check if some electrodes are not present in the list
# and create an object with these electrode names.
notfound=topoplot(word, return.notfound=TRUE)

#define a layout for
mat=matrix(c(1,2), 1, 2, byrow=TRUE)

layout(mat, widths=c(0.8, 0.2))

#make a topoplot excluding not found electrode
par(pty="s")
topo.data=topoplot(word, startmsec=-200, endmsec=1500, win.ini=400, 
win.end=600, exclude=notfound)

#draw the palette on a new empty plot.
par(pty="m", mar=c(0,0,0,0))
plot.new()
topoplot.palette(cols=topo.data$palette, 
palette.lim=topo.data$zlim, p.height=0.6) 

}

erpR documentation built on June 7, 2019, 3 a.m.