如何用R(计算环境)创建一个合理的希尔伯特谱图

Pet*_*mit 2 plot r spectral

我正在使用R 的EMD软件包.该软件包具有用于显示希尔伯特谱的谱图函数(用hilbertspec计算).然而,输出真的是模糊和黑白.

此功能似乎没有输出彩色图像的选项.如何清晰显示光谱,如果可能,还可以显示颜色.

rcs*_*rcs 5

灰度级在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函数的源来定义自己的绘图函数,该函数具有调色板的参数.