【发布时间】:2015-01-17 07:00:46
【问题描述】:
我正在使用命令 image 生成多个图
image(X,Y,MAT,col=heat.colors(100))
此命令处于for 循环中,其中 X、Y 和 MAT 发生变化。
我怎样才能为所有地块使用相同的色标(我必须对它们进行压缩)?如何设置通用色标(我在所有地块中都有最大值和最小值)?
谢谢
【问题讨论】:
我正在使用命令 image 生成多个图
image(X,Y,MAT,col=heat.colors(100))
此命令处于for 循环中,其中 X、Y 和 MAT 发生变化。
我怎样才能为所有地块使用相同的色标(我必须对它们进行压缩)?如何设置通用色标(我在所有地块中都有最大值和最小值)?
谢谢
【问题讨论】:
将所有循环迭代中MAT 的总体最大值和最小值输入到image 的zlim 参数中。
set.seed(1)
xx <- sort(rnorm(10))
yy <- sort(rnorm(10))
zz <- list(matrix(rnorm(100),nrow=10,ncol=10),matrix(rnorm(100)-2,nrow=10,ncol=10))
par(mfrow=c(1,2))
image(xx,yy,z=zz[[1]],col=heat.colors(100))
image(xx,yy,z=zz[[2]],col=heat.colors(100))
image(xx,yy,z=zz[[1]],col=heat.colors(100),zlim=range(unlist(zz)))
image(xx,yy,z=zz[[2]],col=heat.colors(100),zlim=range(unlist(zz)))
【讨论】: