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

发布于 2024-08-14 09:44:47 字数 219 浏览 3 评论 0原文

我正在使用 R 的 EMD 包。该包有用于显示希尔伯特谱(用 hilbertspec 计算)的谱图函数。然而,输出确实很模糊并且是黑白的。

该功能似乎没有输出彩色图像的选项。我怎样才能清晰地显示光谱,如果可能的话,以彩色显示。

I am using the EMD package for R. This package has a spectrogram function for displaying a Hilbert Spectrum (calculated with hilbertspec). The output however, is really vague and black-white.

This function does not seem to have an option for outputting color images. How can I get the spectrum displayed clearly and if possible in color.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昔日梦未散 2024-08-21 09:44:47

灰度级在频谱图函数 (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

另一个选项是使用源的频谱图函数来定义您自己的绘图函数,该函数具有调色板的参数。

The gray levels are hardcoded in the spectrogram function (gray()), to override this setting you could use, for instance, the following:

# 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

Another option is to use the source of the spectrogram function to define your own plot function which has an argument for the color palette.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文