#data
set.seed(1234)
xm1 <- matrix(rnorm(100*10, rnorm(100, 0.5, 0.1)), nrow=100, ncol=10, byrow=FALSE)
xm2 <- matrix(rnorm(100*10, rnorm(100, 0.5, 0.1)), nrow=100, ncol=10, byrow=FALSE)
xm3 <- matrix(rnorm(100*10, rnorm(100, 0.5, 0.1)), nrow=100, ncol=10, byrow=FALSE)
dd <- cbind(xm1, xm2, xm3)
#heatmap plot
require(ggplot2)
# first need to reshape data to long form
require(reshape)
dd.melt <- data.frame(melt(dd) )
ggplot(dd.melt , aes(x=X1,y=X2, z= value)) + geom_tile(aes(fill= value)) + scale_fill_gradient(low="red", high="green") + theme_bw()
set.seed(1234)
xm1 <- matrix(rnorm(100*10, rnorm(100, 0.5, 0.1)), nrow=100, ncol=10, byrow=FALSE)
xm2 <- matrix(rnorm(100*10, rnorm(100, 0.5, 0.1)), nrow=100, ncol=10, byrow=FALSE)
xm3 <- matrix(rnorm(100*10, rnorm(100, 0.5, 0.1)), nrow=100, ncol=10, byrow=FALSE)
dd <- cbind(xm1, xm2, xm3)
#heatmap plot
require(ggplot2)
# first need to reshape data to long form
require(reshape)
dd.melt <- data.frame(melt(dd) )
ggplot(dd.melt , aes(x=X1,y=X2, z= value)) + geom_tile(aes(fill= value)) + scale_fill_gradient(low="red", high="green") + theme_bw()
For RGraph Learn Best websit RGraph Examples
ReplyDelete