R中的真实热图

编程入门 行业动态 更新时间:2024-10-09 19:14:37
本文介绍了R中的真实热图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在R中创建一个真实的热图,就像天气图一样,只是我的数据要简单得多.

I'd like to make a true heat map in R, much like a weather map, except my data is much more simple.

请考虑以下3d数据:

x <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4) y <- c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5) z <- rnorm(20)

z是彩色的.

以下是此数据的离散热图:

Here is what a discrete looking heatmap would like for this data:

如何制作热图,以使颜色平滑,并基于z值将2d空间填充为平滑的颜色.

How can I make a heatmap such that the colors are smooth and the full 2d space is filled with smoothed out colors based on the z values.

请提供示例代码,而不仅仅是可能会使我更加困惑的链接,而且我可能已经访问了该站点.谢谢:)

Please include sample code, not just a link that will probably confuse me even more, and I've probably already visited that site anyhow. Thanks :)

推荐答案

使用以下内容:

interp

image.plot

x <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4) y <- c(1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5) z <- rnorm(20) library(fields) library(akima) s <- interp(x,y,z) image.plot(s)

更多推荐

R中的真实热图

本文发布于:2023-07-18 14:20:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1145653.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:热图   真实

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!