此外,image
可能会有所帮助:
#matrix with the part of your data 10x10 you uploaded
mat <- as.matrix(read.table(text = "0 0 0 0 0 0 0 0 0 0
41 10 2 0 0 0 0 0 0 0
75 36 20 9 4 2 1 0 0 0
91 65 47 31 20 13 8 5 3 2
97 78 64 47 35 25 18 12 8 5
99 88 76 63 50 39 29 22 16 11
99 93 85 74 63 52 42 32 25 19
99 96 91 83 73 64 53 44 35 28
99 98 94 88 81 72 64 54 46 37
99 98 96 92 87 80 72 64 55 47"))
#neccessary step to `image` the expected. read `?image`
t_mat <- t(mat[ncol(mat):1,])
#basic plot
image(t_mat, col = colorRampPalette(c("blue", "red"))(10), axes = F)
#creaty matrix with `NA`s and fill
#only the values you want to appear yellow.
#here: say 45 to 55
yellows <- matrix(nrow = nrow(t_mat), ncol = ncol(t_mat))
yellows[which(t_mat > 45 & t_mat < 55)] <- t_mat[which(t_mat > 45 & t_mat < 55)]
#overlay "yellows" to basic plot
image(yellows, col = rgb(1,1,0,1/2), add = T)
情节看起来:
PS我猜这就是黄色边框的用途。对不起,如果我误解了。
编辑
添加了示例legend
和标签:
title(main = "imageplot", xlab = "x axis", ylab = "y axis")
legend(x = 0.6, y = 1.15, legend = c("<45", "45-55", ">55"),
fill = c("blue", rgb(1,1,0,1/2), "red"), xpd = T, ncol = 3)
编辑2
为两个轴添加了标签:
#I guess you'll need to use `axis(1, at = seq(0,1,0.0101), labels = seq(1, 100, 1))`
#but I'm not sure
axis(1, at = seq(0,1,0.11), labels = seq(1, 10, 1))
axis(2, at = seq(0,1,0.11), labels = seq(1, 10, 1))