Learn R Programming

icaOcularCorrection (version 1.3)

plotICs.fnc: Function to plot the ICA-corrected EEG against uncorrected EEG.

Description

Function to plot the ICA-corrected EEG against uncorrected EEG. Also plots the EOGs in a different X11 window.

Usage

plotICs.fnc(ica.object, epoch.length = NULL, cor.only = FALSE, 
whichEOG = c("VEOG", "HEOG"), method = "by.trial", dir.create.path = 
file.path(getwd(), "figs"), dir.create.name = "IC.plots", 
recursive = TRUE, threshold = NA, nplots = c(2, 2), ask = TRUE, 
plot.EOG = TRUE, pdf.it = FALSE, pdf.prefix = "ICs_", 
pdf.compress = FALSE)

Arguments

ica.object
An icaDEN.fnc denoised object.
epoch.length
If performing by-trial correction, then supply the length of each trial in number of data points (e.g., 192, 179). If performing ICA correction on whole data at once, do not need this (set to NULL).
cor.only
Logical. Defaults to FALSE. If TRUE, will plot only the ICs that correlated with the EOGs at or above threshold.
whichEOG
Vector of EOG channels to plot.
method
For one subject and one electrode, either perform "by-trial" correction (default) or correction on the whole vector ("all").
dir.create.path
The path where a directory will be created, in which the corrected files will be placed. Defaults to file.path(getwd(), "figs").
dir.create.name
The name of the directory where the corrected files will be placed. Defaults to "IC.plots".
recursive
Logical. Should elements of the path other than the last be created? If TRUE, like Unix's mkdir -p. Value passed to recursive argument of dir.create.
threshold
The correlation threshold between EOG and IC. Default is 0.4. Can be set to anything between 0 (will zero-out every IC) and 1 (will most probably zero-out nothing).
nplots
Number of panels per page.
ask
Logical. Defaults to TRUE. If TRUE (and the R session is interactive) the user is asked for input, before a new figure is drawn.
plot.EOG
Logical. If TRUE, a second X11 window will be opened to plot the EOG channels named in the argument whichEOG.
pdf.it
Logical. Defaults to FALSE. If TRUE, the plots will be saved in a pdf file.
pdf.prefix
A prefix to add in front of the name of the corrected files. Defaults to "ICs_".
pdf.compress
Logical (defaults to FALSE). If you have the pdftk tool installed on your system, whether to compress .pdf files.

Value

  • One PDF file per page.

concept

  • EEG
  • electro-encephalogram
  • electroencephalogram
  • ERP
  • event-related potentials
  • event related potentials

See Also

defineElectrodeSet.fnc; eeg; den; batch.icaDEN.fnc; mc.batch.icaDEN.fnc; icaDEN.fnc; batch.plotICs.fnc

Examples

Run this code
data(den)
# plot ICs
plotICs.fnc(den, epoch.length = 192, cor.only = 
    FALSE, whichEOG = c("VEOG", "HEOG"), 
    method = "by.trial", dir.create.path = 
    paste(getwd(), "/figs/", sep = ""), 
    dir.create.name = "IC.plots", threshold = 
    0.4, nplots = c(2, 2), ask = TRUE, plot.EOG = 
    TRUE, pdf.it = FALSE, pdf.prefix = "ICs_")

Run the code above in your browser using DataLab