[R] image plot with color scale

Witold E Wolski wewolski at gmail.com
Tue Nov 19 12:07:49 CET 2013


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)


> tried image.plot from package fields but :

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

-- 
Witold Eryk Wolski



More information about the R-help mailing list