imageValues: Image plot of channel values

Description Usage Arguments Value See Also Examples

View source: R/plots.R

Description

imageValues creates an image plot from a matrix or array of channel x time values

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
imageValues(
  dat,
  grid = NULL,
  wrap = NULL,
  bar_title = "effect",
  time_label = "Time (ms)",
  channel_label = "Channels",
  raster = TRUE,
  cluster_order = FALSE,
  low = scales::muted("blue"),
  mid = "white",
  high = scales::muted("red"),
  midpoint = 0,
  ...
)

Arguments

dat

numeric matrix or array of values with named dimensions (at least chan and time)

grid

character vector or formula defining the layout of panels

wrap

character vector or formula defining the dimension which separates panels (only considered if grid is NULL)

bar_title

character string; the title of the colour bar

time_label

character string; the label of the x (time) axis (default: "Time (ms)")

channel_label

character string; the label of the y (channel) axis default: "Channels")

raster

use raster image (TRUE, default) or not (FALSE)

cluster_order

logical; if TRUE, channels are ordered with hierarchical agglomerative clustering (default: FALSE)

low, mid, high

colour for low/mid/high end of gradient, respectively

midpoint

the midpoint (in data value) of the diverging scale (default: 0)

...

other arguments passed to scale_fill_gradient2

Value

A ggplot object

See Also

imagePvalues for plotting p-values, and plotERParray for multiline (butterfly) plots

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# example dataset
data(erps)

# plot grand averages
avgs <- avgDims(erps, "id")
imageValues(avgs)

# imageValues returns a ggplot object, which can be modified afterwards
implot <- imageValues(avgs)

# modify faceting and theme
library(ggplot2)
implot + facet_grid(pairtype ~ stimclass) + theme_bw()

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