Skip to content
Prev 333359 / 398502 Next

image plot with color scale

I am plotting an image of correlations but need to add a color scale...

dat<-matrix(rnorm(1000),ncol=5)
labels=c("a","b","c","d","e")
cortmp <- cor(dat)

image(cortmp , axes = F )
axis( 1, at=seq(0,1,length=length(labels)) , labels=labels ,
cex.axis=0.8 ,srt = 45,las=2,cex=1)
axis( 2, at=seq(0,1,length=length(labels)) , labels=labels ,
cex.axis=0.8 ,srt = -45,las=1,cex=1)
image.plot(cortmp , axes = F )
axis( 1, at=seq(0,1,length=length(labels)) , labels=labels ,
cex.axis=0.8 ,srt = 45,las=2,cex=1)
axis( 2, at=seq(0,1,length=length(labels)) , labels=labels ,
cex.axis=0.8 ,srt = -45,las=1,cex=1)


but adding the axis fails... (the axis appears but the labls are not shown.

Can anyone can suggest an easy to use image function in R?

best
Witold