# NOT RUN {
{
### create image with text to use in the spectrogram
# remove margins of plot
par(mar = rep(0, 4))
# empty plot
plot(0, type='n',axes = FALSE, ann = FALSE, xlim = c(0, 1), ylim = c(0, 1))
# text to include
text <- " warbleR "
# add text
text(x = 0.5, y = 0.5, labels = text, cex = 11, font = 1)
# save image in temporary directory
dev2bitmap(file.path(tempdir(), "temp-img.png"), type = "pngmono", res = 30)
# read it
wv <- image_to_wave(file = file.path(tempdir(), "temp-img.png"), plot = TRUE, flim = c(1, 12))
# output wave object
# wv
## plot it
# reset margins
par(mar = c(5, 4, 4, 2) + 0.1)
# plot spectrogram
# spectro(wave = wv, scale = FALSE, collevels = seq(-30, 0, 5),
# palette = reverse.terrain.colors, ovlp = 90, grid = FALSE, flim = c(2, 11))
}
# }
Run the code above in your browser using DataLab