本文介绍了将相关矩阵绘制成图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有一些相关值的矩阵。现在,我想在一个看起来或多或少像这样的图形中绘制它:
I have a matrix with some correlation values. Now I want to plot that in a graph that looks more or less like that:
我该如何实现?
推荐答案
快速,肮脏并且在球场上:
Quick, dirty, and in the ballpark:
library(lattice)
#Build the horizontal and vertical axis information
hor <- c("214", "215", "216", "224", "211", "212", "213", "223", "226", "225")
ver <- paste("DM1-", hor, sep="")
#Build the fake correlation matrix
nrowcol <- length(ver)
cor <- matrix(runif(nrowcol*nrowcol, min=0.4), nrow=nrowcol, ncol=nrowcol, dimnames = list(hor, ver))
for (i in 1:nrowcol) cor[i,i] = 1
#Build the plot
rgb.palette <- colorRampPalette(c("blue", "yellow"), space = "rgb")
levelplot(cor, main="stage 12-14 array correlation matrix", xlab="", ylab="", col.regions=rgb.palette(120), cuts=100, at=seq(0,1,0.01))
这篇关于将相关矩阵绘制成图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!