Like this?
image(m[,c(1,1,1,2,2,3)], col=z(50), xaxt= "n", yaxt= "n")
Question
I have a data frame like this:
X<-c(100,90,80,70,65,60,55,50,45,40)
Y<-c(10,20,30,40,35,30,25,20,15,10)
Z<-c(50,40,30,20,30,40,50,60,70,80)
df<-as.data.frame(cbind(X,Y,Z))
df
X Y Z
1 100 10 50
2 90 20 40
3 80 30 30
4 70 40 20
5 65 35 30
6 60 30 40
7 55 25 50
8 50 20 60
9 45 15 70
10 40 10 80
X,Y and Z represent distance or length of 0.23Km, 1.756Km and 3.452Km respectively. I am able to create a heatmap like this but all rows have the same height:
m<-as.matrix(df)
library(fields)
z<-colorRampPalette(c("green","yellow", "red","black"))
image(m, col=z(50), xaxt= "n", yaxt= "n")
I want to adjust the height of the heatmap cells according to the lengths of X, Y and Z the height of heat map rows will be proportional to the given lengths of X, Y and Z (0.23 unit, 1.756 units and 3.452 units).
La solution
Like this?
image(m[,c(1,1,1,2,2,3)], col=z(50), xaxt= "n", yaxt= "n")