plot_butterfly: Create a butterfly plot from timecourse data

Description Usage Arguments Value Methods (by class) Notes on ggplot2 facetting Author(s) Examples

View source: R/plot_butterfly.R

Description

Typically event-related potentials/fields, but could also be timecourses from frequency analyses for single frequencies. Output is a ggplot2 object. CIs not possible.

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
plot_butterfly(data, ...)

## Default S3 method:
plot_butterfly(
  data,
  time_lim = NULL,
  baseline = NULL,
  colourmap = NULL,
  legend = TRUE,
  continuous = FALSE,
  browse_mode = FALSE,
  allow_facets = FALSE,
  ...
)

## S3 method for class 'eeg_evoked'
plot_butterfly(
  data,
  time_lim = NULL,
  baseline = NULL,
  colourmap = NULL,
  legend = TRUE,
  continuous = FALSE,
  browse_mode = FALSE,
  allow_facets = FALSE,
  ...
)

## S3 method for class 'eeg_data'
plot_butterfly(
  data,
  time_lim = NULL,
  baseline = NULL,
  legend = TRUE,
  allow_facets = FALSE,
  browse_mode = FALSE,
  ...
)

## S3 method for class 'eeg_epochs'
plot_butterfly(
  data,
  time_lim = NULL,
  baseline = NULL,
  legend = TRUE,
  allow_facets = FALSE,
  browse_mode = FALSE,
  ...
)

## S3 method for class 'eeg_stats'
plot_butterfly(
  data,
  time_lim = NULL,
  baseline = NULL,
  legend = TRUE,
  allow_facets = FALSE,
  browse_mode = FALSE,
  ...
)

Arguments

data

EEG dataset. Should have multiple timepoints.

...

Other parameters passed to plot_butterfly

time_lim

Character vector. Numbers in whatever time unit is used specifying beginning and end of time-range to plot. e.g. c(-.1,.3)

baseline

Character vector. Times to use as a baseline. Takes the mean over the specified period and subtracts. e.g. c(-.1, 0)

colourmap

Attempt to plot using a different colourmap (from RColorBrewer). (Not yet implemented)

legend

Include plot legend. Defaults to TRUE.

continuous

Is the data continuous or not (I.e. epoched)

browse_mode

Custom theme for use with browse_data.

allow_facets

Allow use of ggplot2 facetting. See note below. Defaults to FALSE.

Value

ggplot2 object showing ERPs for all electrodes overlaid on a single plot.

Methods (by class)

Notes on ggplot2 facetting

In order for ggplot2 facetting to work, the data has to be plotted using 'stat_summary()' rather than 'geom_line()', so that the plots can still be made when not all categorical variables are reflected in the facets. e.g. if there are two variables with two levels each, but you want to average over one of those variables, 'stat_summary()' is required. However, 'stat_summary()' is extremely slow.

Author(s)

Matt Craddock, matt@mattcraddock.com

Examples

1
2
3
4

kusumikakd/EEG documentation built on June 28, 2020, 12:30 a.m.