PlotSinglePowerBand: PlotSinglePowerBand

View source: R/PlotPowerBand.R

PlotSinglePowerBandR Documentation

PlotSinglePowerBand

Description

Plots a concrete power band computed by the CalculatePowerBand function

Usage

PlotSinglePowerBand(HRVData, indexFreqAnalysis = length(HRVData$FreqAnalysis),
  band = c("LF", "HF", "ULF", "VLF", "LF/HF"), normalized = FALSE,
  main = paste(band, "Power Band"), xlab = "Time",
  ylab = paste("Power in", band), type = "l", Tags = NULL,
  Indexes = NULL, eplim = NULL, epColorPalette = NULL,
  markEpisodes = TRUE, ymark = NULL, showEpLegend = TRUE,
  epLegendCoords = NULL, Tag = NULL, ...)

Arguments

HRVData

Data structure that stores the beats register and information related to it

indexFreqAnalysis

Numeric parameter used to reference a particular frequency analysis

band

The frequency band to be plotted. Allowd bands are "ULF", "VLF", "LF" (default), "HF" and "LF/HF")

normalized

Plots normalized powers if TRUE

main

A main title for the plot.

xlab

A label for the x axis.

ylab

A label for the y axis

type

1-character string giving the type of plot desired. See plot.default.

Tags

List of tags to specify which episodes, as apnoea or oxygen desaturation, are included in the plot. Tags="all" plots all episodes present in the data.

Indexes

List of indexes of episodes (see ListEpisodes) to specify which episodes are included in the plot. Indexes="all" plots all episodes present in the data.

eplim

Two-component vector specifying the y-range (min,max) for the vertical lines limiting each episode.

epColorPalette

Vector specifying the color of each of the episodes that will be plotted. The length of colorPalette should be equal or greater than the number of different episodes to be plotted.

markEpisodes

Boolean specyfing if a horizontal mark should be included for each of the episodes.

ymark

Two-component vector specifying the y-range (min,max) for the horizontal marks. Only used if markEpisodes = TRUE.

showEpLegend

Boolean argument. If TRUE, a legend of the episodes is included.

epLegendCoords

Two-component vector specifiying the coordinates where the legend should be placed. By defaul, the legend is placed on top of the plot.

Tag

Deprecated argument maintained for compatibility, use Tags instead

...

Other graphical parameters for plotting the power band. See plot.default.

See Also

CalculatePowerBand for power calculation

Examples

## Not run: 

# Read file "a03" from the physionet apnea-ecg database
library(RHRV)
HRVData <- CreateHRVData()
HRVData <- LoadBeatWFDB(HRVData,RecordName="test_files/WFDB/a03")
HRVData <- LoadApneaWFDB(HRVData,RecordName="test_files/WFDB/a03")
# Calculating heart rate signal:
HRVData <- BuildNIHR(HRVData)
 
# Filtering heart rate signal:
HRVData <- FilterNIHR(HRVData)

# Interpolating heart rate signal:
HRVData = InterpolateNIHR(HRVData)

HRVData = CreateFreqAnalysis(HRVData)
HRVData = CalculatePowerBand(HRVData, indexFreqAnalysis = 1,
          size = 300, shift = 60, sizesp = 1024)
          
layout(matrix(1:4, nrow = 2))
PlotSinglePowerBand(HRVData, 1, "VLF", Tags = "APNEA", epColorPalette = "red",
                    epLegendCoords = c(2000,7500))
PlotSinglePowerBand(HRVData, 1, "LF", Tags = "APNEA", epColorPalette = "red",
                    eplim = c(0,6000),
                    markEpisodes = F, showEpLegend = FALSE)
PlotSinglePowerBand(HRVData, 1, "HF", Tags = "APNEA", epColorPalette = "red",
                    epLegendCoords = c(2000,1700))
PlotSinglePowerBand(HRVData, 1, "LF/HF", Tags = "APNEA", epColorPalette = "red",
                    eplim = c(0,20),
                    markEpisodes = F, showEpLegend = FALSE)
# Reset layout
par(mfrow = c(1,1))

## End(Not run)

RHRV documentation built on Jan. 16, 2024, 3:05 a.m.