standard.spg.image: make a bitmap picture of a spectrogram that should look nice...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/standard.spg.image.R

Description

makes a black-and-white bitmap with darkness denoting amplitude, with lots of user control over appearance. The output file is in PNG format

Usage

1
standard.spg.image(spg, path = "default.png", amplitude.threshold = 0, time.offset = 0, ...)

Arguments

spg

a spectrogram object

path

the location of the image file that will be produced

amplitude.threshold

any amplitude less than this threshold will be ignored

time.offset

you may want to shift the time axis to match up with other files

...

further arguments to plot.spg

Value

none

Author(s)

Benjamin N. Taft [email protected]

See Also

plot.spg png

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (spg, path = "default.png", amplitude.threshold = 0, 
    time.offset = 0, ...) 
{
    if (is(spg) == "spg") {
        png(path, 5 * 180, 3 * 180, pointsize = 10, res = 180)
        par(mar = c(10, 10, 2, 2)/3, mgp = 2 * c(3, 1, 0)/3)
        temp <- -spg
        temp[temp > amplitude.threshold] <- amplitude.threshold
        image(attr(spg, "time"), attr(spg, "frequency")/1000, 
            temp, col = gray.colors(512, 0, 1), xlab = "Time (s)", 
            xlim = c(0, 3) + time.offset, ylab = "Frequency (kHz)", 
            ylim = c(0, 10), ...)
        dev.off()
    }
  }

landmarkacoustics/SoundPoints-R documentation built on Sept. 26, 2018, 9:08 a.m.