我刚开始使用R,现在我试图使用matrixplot函数绘制每个站点每年的信息量,如下所示:
a< - dwi(Monthly_data [,1:54],out.unit =“years”,dates = 1)
matrixplot(a,var.type =“Days”,main =“每年信息的月数”)
我在颜色条上用2-12得到了刻度图。 enter image description here
我想将彩条上的比例更改为0-12。我尝试使用xlim和ylim,但它们都不能在colorbar上工作。请给我任何建议。谢谢。
答案 0 :(得分:0)
我希望这就是你要找的东西:
require(hydroTSM)
data(EbroPPtsMonthly)
Monthly_data <- EbroPPtsMonthly
a <- dwi(Monthly_data[,1:54], out.unit = "years", dates=1)
cols = colorRampPalette(c("red", "green"))
matrixplot(
x = a
, main="Number of months with info per year"
, ColorRamp = cols
, at = c(0,1,2,3,4,5,6,7,8,9,10,11,12)
, colorkey = list(
at=seq(from=0, to=12, by=1)
, labels = c("0","1","2","3","4","5","6","7","8","9","10","11","12")
, col = cols
)
)
让我们继续计算雨滴...... 555