本文介绍了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中的真实热图
发布评论