
Standardized Spectrogram plus Mean Power Spectrum
Source:R/spectrogram_ggplot.R
spectrogram_ggplot.Rd
Standardized Spectrogram plus Mean Power Spectrum
Usage
spectrogram_ggplot(
wave,
meanspec = TRUE,
widths = c(10, 1),
cutoff = -35,
scale_type = "dB",
overlap = 95,
zeropad = 200,
margin_l = 10,
margin_r = 0,
margin_t = 0,
margin_b = 10,
show_axis_titles = TRUE
)
Arguments
- wave
A
Wave
object from thetuneR
package, representing the audio signal to be analyzed.- meanspec
Logical. If
TRUE
, a mean power spectrum is plotted alongside the spectrogram. The spectrum is flipped and positioned to the right.- widths
A numeric vector of length 2 specifying the relative widths of the spectrogram and the mean power spectrum when
meanspec = TRUE
. Defaults toc(10, 1)
.- cutoff
Numeric. The amplitude cutoff in dB relative to the peak amplitude. Any amplitude below this cutoff will not be visible in the spectrogram. Defaults to
-35
.- scale_type
Character. The scale used for the amplitude. Either
"dB"
for decibel scaling or"Linear"
for a linear amplitude scale. Defaults to"dB"
.- overlap
Numeric. The percentage of overlap between successive windows for spectrogram calculation. Defaults to
95
.- zeropad
Numeric. The number of zero-padding points to add to each window to increase frequency resolution. Defaults to
200
.- margin_l
Numeric. The left margin (in points) around the plot. Defaults to
10
.- margin_r
Numeric. The right margin (in points) around the plot. Defaults to
0
.- margin_t
Numeric. The top margin (in points) around the plot. Defaults to
0
.- margin_b
Numeric. The bottom margin (in points) around the plot. Defaults to
10
.- show_axis_titles
Logical. If
TRUE
, axis titles for time and frequency will be displayed on the spectrogram. Defaults toTRUE
.
Value
A ggplot2
object representing the spectrogram, with the option
to include a mean power spectrum on the right side.
Examples
if (FALSE) { # \dontrun{
data(coryphoda)
# Create a spectrogram with a mean power spectrum for a wave object:
spectrogram_ggplot(coryphoda, meanspec = TRUE, cutoff = -40,
scale_type = "dB")
# Create a spectrogram without the mean power spectrum:
spectrogram_ggplot(coryphoda, meanspec = FALSE)
} # }