Skip to contents

Create a Q-transform spectrogram stacked with its oscillogram using ggplot2.

Usage

plot_spectro(
  ts,
  tzero = 0,
  trange = NULL,
  frange = c(32, 512),
  qrange = c(40, 1),
  crange = NULL,
  tres = 1000,
  fres = 1000,
  logf = T,
  title = NULL,
  specScale = FALSE,
  specXlabel = FALSE,
  specYlabel = TRUE,
  specGrid = "none",
  specColorPal = viridis::viridis(256),
  trans = NULL,
  specScaleDir = "vertical",
  specScalePos = "ul",
  linecolor = "black",
  osciLegend = FALSE,
  osciXlabel = TRUE,
  osciYlabel = TRUE,
  stack = T,
  ...
)

Arguments

ts

A time series object.

tzero

Time offset (default: 0).

trange

Time range for cropping the data.

frange

Frequency range for spectrogram.

qrange

Q-factor range for Q-transform.

crange

Color range (z-axis) for spectrogram.

tres

Time resolution.

fres

Frequency resolution.

logf

Logical; log-scale y-axis (default: TRUE).

title

Title of the plot.

specScale

Logical; Show colorbar for spectrogram.

specXlabel

Logical; Show x-axis label for spectrogram.

specYlabel

Logical; Show y-axis label for spectrogram.

specGrid

Show grid lines ("x", "y", "xy").

specColorPal

Color palette.

trans

Transformation function applied to spectrogram values.

specScaleDir

Direction of colorbar.

specScalePos

Position of colorbar ("ul", "ur", "bl", "br").

linecolor

Line color for oscillogram.

osciLegend

Logical; Show legends for oscillogram.

osciXlabel

Logical; Show x-axis label for oscillogram.

osciYlabel

Logical; Show y-axis label for oscillogram.

stack

Logical; stack spectrogram and oscillogram (default: TRUE).

...

Additional arguments passed to ggarrange.

Value

A ggplot object, or a list with spec.plot and osci.plot if stack = FALSE.