Skip to contents

Create a ggplot object resembling a scalogram

Usage

# S3 method for class 'fcwtr_scalogram'
autoplot(
  object,
  n = 1000,
  time_unit = "s",
  freq_unit = "Hz",
  transf = identity,
  ...
)

Arguments

object

A "fcwtr_scalogram" object resulting from fcwt().

n

The plotting function reduces the time resolution by averaging to generate a reasonable graphics format. n is the number of time steps that are plotted. Defaults to n = 1000.

time_unit

A time unit that is used for the x-axis scale. Default to "s" - seconds. See units::valid_udunits() and units::valid_udunits_prefixes() for valid expressions.

freq_unit

A frequency unit that is used for the y-axis scale. Defaults to "Hz" - "Hertz". See units::valid_udunits() and units::valid_udunits_prefixes() for valid expressions.

transf

A function, taking a vector and returning a vector, that is used to transform the scalogram values before plotting.

...

other arguments passed to specific methods

Value

A ggplot object.

Examples

library(ggplot2)

res <-
  fcwt(
    sin((1:4410) * 2 * pi * 440 / 44100),
    x_sample_freq = u(44100, "Hz"),
    freq_begin = u(50, "Hz"),
    freq_end = u(1000, "Hz"),
    n_freqs = 10,
    sigma = 5
  )

autoplot(res, time_unit = "ms")