| threeDspectro {SoundShape} | R Documentation |
3D spectrogram plots from "Wave" objects
Description
Create 3D spectrograms from a single object of class "Wave".
This function works similarly as spectro (seewave package), with spectrogram data internally computed by spectro. However, the 3D plot is generated by persp3D (plot3D package).
Usage
threeDspectro(
wave,
tlim = NULL,
flim = NULL,
samp.grid = FALSE,
plot.type = "surface",
along = "x",
skip.lines = 5,
space.lines = 0.6,
x.length = 100,
y.length = 70,
lwd = 0.1,
plot.exp = FALSE,
log.scale = FALSE,
cex = 0.5,
cex.axis = 0.5,
cex.lab = 0.9,
cex.main = 1,
store.at = NULL,
plot.as = "jpeg",
color = seewave::spectro.colors(80),
f = 44100,
wl = 512,
ovlp = 70,
dBlevel = 30,
resfac = 1,
rotate.Xaxis = 60,
rotate.Yaxis = 40,
main = "Spectrogram 3D",
scalelab = expression("Amplitude (dB)"),
colkey = list(plot = TRUE, cex.clab = 0.8, cex.axis = 1, side = 4, length = 1, width =
1, labels = TRUE, tick = TRUE, lty = 1, lwd = 1, lwd.ticks = 1)
)
Arguments
wave |
an |
tlim |
modifications of the time limits (X-axis). Vector with two values in seconds. By default: |
flim |
modifications of the frequency limits (Y-axis). Vector with two values in kHz. By default: |
samp.grid |
a logical. If |
plot.type |
allows the choice between |
along |
only applies when |
skip.lines |
only applies when |
space.lines |
only applies when |
x.length |
only applies when |
y.length |
only applies when |
lwd |
only applies when |
plot.exp |
a logical. If |
log.scale |
only applies when |
cex |
only applies when |
cex.axis |
Similarly as in |
cex.lab |
Similarly as in |
cex.main |
Similarly as in |
store.at |
only applies when |
plot.as |
only applies when |
color |
Color palette to be used for the amplitude (Z-axis). Same default as |
f |
sampling frequency of |
wl |
length of the window for spectrogram calculation. By default: |
ovlp |
overlap between two successive windows (in %) for increased spectrogram resolution. By default: |
dBlevel |
absolute amplitude value to be used as relative background on 3D plot. Same as |
resfac |
resolution factor, in which an value > 1 will increase the resolution. Can be one value or a vector of two numbers, for the x and y values, respectively. Note: Same as in |
rotate.Xaxis |
rotation of the X-axis. Same as |
rotate.Yaxis |
rotation of the Y-axis. Same as |
main |
main title of output plot. Should be presented between quotation marks. By default: |
scalelab |
Similarly as |
colkey |
Similarly as |
Details
Similarly as spectro (seewave package), any colour palette can be used to describe the amplitude (Z-axis). Some suggestions: seewave::temp.colors, seewave::spectro.colors, seewave::reverse.heat.colors, seewave::reverse.cm.colors, seewave::reverse.topo.colors, grDevices::cm.colors, grDevices::grey.colors, grDevices::heat.colors, grDevices::topo.colors.
Author(s)
Pedro Rocha
References
MacLeod, N., Krieger, J. & Jones, K. E. (2013). Geometric morphometric approaches to acoustic signal analysis in mammalian biology. Hystrix, the Italian Journal of Mammalogy, 24(1), 110-125.
Rocha, P. & Romano, P. (2021) The shape of sound: A new R package that crosses the bridge between Bioacoustics and Geometric Morphometrics. Methods in Ecology and Evolution, 12(6), 1115-1121.
See Also
spectro, seewave, eigensound, align.wave, persp3D, plot3D, align.wave
Useful links:
Examples
# As simple as this
threeDspectro(centralis)
threeDspectro(cuvieri)
threeDspectro(kroyeri)
# Controling some arguments
threeDspectro(cuvieri, tlim=c(0, 0.5), flim=c(0, 4))
threeDspectro(cuvieri, tlim=c(0, 0.5), flim=c(0, 4), dBlevel=50)
# As points
threeDspectro(cuvieri, tlim=c(0, 0.5), flim=c(0, 4),
samp.grid=TRUE, plot.type="points")
threeDspectro(cuvieri, tlim=c(0, 0.5), flim=c(0, 4),
samp.grid=TRUE, plot.type="points", x.length = 20, y.length = 50)
# As lines
threeDspectro(cuvieri, tlim=c(0, 0.5), flim=c(0, 4), plot.type = "lines")
threeDspectro(cuvieri, tlim=c(0, 0.5), flim=c(0, 4),
plot.type = "lines", along="y")
threeDspectro(cuvieri, tlim=c(0, 0.5), flim=c(0, 4),
plot.type = "lines", along="y", skip.lines=18, space.lines=0.8)
# Try different colors
threeDspectro(cuvieri, color=seewave::reverse.terrain.colors(80),
samp.grid=FALSE, tlim=c(0, 0.5), flim=c(0, 4))
threeDspectro(cuvieri, color=seewave::reverse.cm.colors(80),
samp.grid=FALSE, tlim=c(0, 0.5), flim=c(0, 4))
threeDspectro(cuvieri, color=grDevices::heat.colors(80),
samp.grid=FALSE, tlim=c(0, 0.5), flim=c(0, 4))
# Rotation
threeDspectro(cuvieri, tlim=c(0, 0.5), flim=c(0, 4), rotate.Xaxis=40, rotate.Yaxis=50)
# Export your graph
threeDspectro(cuvieri, plot.exp=TRUE, store.at=tempdir(), tlim=c(0,0.5), flim=c(0,4))