R中的真热图
我想用R做一个真正的热图,就像天气图一样,只是我的数据要简单得多 考虑以下3d数据:R中的真热图,r,heatmap,R,Heatmap,我想用R做一个真正的热图,就像天气图一样,只是我的数据要简单得多 考虑以下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) x使用以下方法: akima包中的interp 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
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)
x使用以下方法:
akima
包中的interp
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)
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)
x平滑。在字段
包中,2d
做得很好(对于更多的输入点,它比akima
包中的interp
快得多)
library(fields)
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)
s = smooth.2d(z, x=cbind(x,y), theta=0.5)
image.plot(s)
库(字段)
x另一个打印选项是使用ggplot2中的geom_平铺几何体。有没有办法在默认软件包中获得此颜色方案?