【问题标题】:Keep same colour scale between image plots (R)在图像图之间保持相同的色标 (R)
【发布时间】:2015-01-17 07:00:46
【问题描述】:

我正在使用命令 image 生成多个图

image(X,Y,MAT,col=heat.colors(100))

此命令处于for 循环中,其中 X、Y 和 MAT 发生变化。

我怎样才能为所有地块使用相同的色标(我必须对它们进行压缩)?如何设置通用色标(我在所有地块中都有最大值和最小值)?

谢谢

【问题讨论】:

    标签: r colors


    【解决方案1】:

    将所有循环迭代中MAT 的总体最大值和最小值输入到imagezlim 参数中。

    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)))
    

    【讨论】:

    • 正是我想要的。谢谢
    猜你喜欢
    • 2016-12-31
    • 1970-01-01
    • 1970-01-01
    • 2015-08-18
    • 1970-01-01
    • 1970-01-01
    • 2021-09-18
    • 1970-01-01
    • 2014-03-01
    相关资源
    最近更新 更多