【发布时间】:2010-12-25 23:33:39
【问题描述】:
我正在为 R 使用 EMD 包。该包具有用于显示希尔伯特谱的谱图功能(使用 hilbertspec 计算)。然而,输出实际上是模糊的和黑白的。
此功能似乎没有输出彩色图像的选项。我怎样才能清楚地显示光谱,如果可能的话以彩色显示。
【问题讨论】:
我正在为 R 使用 EMD 包。该包具有用于显示希尔伯特谱的谱图功能(使用 hilbertspec 计算)。然而,输出实际上是模糊的和黑白的。
此功能似乎没有输出彩色图像的选项。我怎样才能清楚地显示光谱,如果可能的话以彩色显示。
【问题讨论】:
灰度级在 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
另一种选择是使用spectrogram 函数的源代码来定义您自己的绘图函数,该函数具有调色板的参数。
【讨论】: