灰度级在spectrogram函数(gray())中是硬编码的,以覆盖您可以使用的设置,例如,以下内容:
# define a color palette
colors <- colorRampPalette(c("#007FFF", "blue", "#000077"))
gray <- function(x) colors(255*x) # redefine gray palette
spectrogram(test1$amplitude[,1], test1$instantfreq[,1])
gray <- grDevices::gray # reset gray palette function
Run Code Online (Sandbox Code Playgroud)
另一种选择是使用spectrogram函数的源来定义自己的绘图函数,该函数具有调色板的参数.