[R] image plot with color scale

Jim Lemon jim at bitwrit.com.au
Tue Nov 19 12:10:21 CET 2013


On 11/19/2013 10:07 PM, Witold E Wolski wrote:
> 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?
>
Hi Witold,
You may find that color2D.matplot (plotrix) will do what you want.

Jim



More information about the R-help mailing list