Learn R Programming

emuR (version 2.4.0)

plot.spectral: Plot spectra from EMU spectral objects

Description

The function plots spectrum of any EMU spectral object.

Usage

# S3 method for spectral
plot(
  x,
  labs,
  ylim,
  xlim,
  col,
  lty,
  lwd,
  fun,
  freq,
  type = "l",
  power = FALSE,
  powcoeffs = c(10, 10),
  dbnorm = FALSE,
  dbcoeffs = c(0, 0),
  legend = TRUE,
  axes = TRUE,
  ...
)

Arguments

x

An EMU object of class 'spectral'

labs

An optional vector character labels. Must be the same length as specdata

ylim

A two-element numeric vector for the y-axis range (see 'par')

xlim

A two-element numeric vector for the x-axis range (see 'par')

col

Specify a color - see 'mu.colour')

lty

Specify a linetype - see 'mu.colour'

lwd

Specify line thickness - see 'mu.colour'

fun

An R function name e.g., mean, var, sum, etc. The function is applied separately to each category type specified in labs

freq

A numeric vector the same length as the number of columns in specdata specifying the frequencies at which the spectral data is to be plotted. If not supplied, defaults to trackfreq(specdata)

type

A single element character vector for the linetype

power

Logical. If TRUE, then specdata (or specdata$data if specdata is a trackdata object, is converted to a * specdata\(\mbox{\textasciicircum}\)b, where a and b have the values given in powcoeffs. This operation is applied before b

powcoeffs

A two-element numeric vector. Defaults to c(10, 10)

dbnorm

Logical. If TRUE, apply dB-level normalization per spectrum as defined by dbcoeffs below. Defaults to FALSE.

dbcoeffs

A two element numeric vector (x, y). The spectra are normalised in such a way that the values of each spectrum at a frequency of y are set to a dB level of x. For example, to normalise the spectrum to 10 dB at 2000 Hz, set dbnorm to TRUE and dbcoeffs to c(2000, 10)

legend

Parameters for defining the legend. See 'mu.legend' for further details

axes

A logical vector indicating whether the axes should be plotted

...

Further graphical parameters may be supplied.

Author

Jonathan Harrington

Details

This function is implemented when a spectral trackdata object is called with the 'plot' function.

See Also

plot plot.trackdata as.spectral

Examples

Run this code
if (FALSE) {

plot(vowlax.dft.5[1,])

# with label types
plot(vowlax.dft.5[1:20,], vowlax.l[1:20])

# As above but averaged after converting to power ratios.
plot(vowlax.dft.5[1:20,], vowlax.l[1:20], fun=mean, power=TRUE)

# All the spectra of one segment in a trackdata object
plot(fric.dft[1,])

}

Run the code above in your browser using DataLab