[R] rect function

Jim Lemon jim at bitwrit.com.au
Wed Oct 14 13:34:53 CEST 2009


On 10/14/2009 10:20 PM, Rene wrote:
> Dear all,
>
>
>
> I have a question about how to load data or (entering data )to each cell of
> a rectangle created by rect .
>
>
>
> e.g.
>
> I have a matrix
>
> rbind(1:2,1:2)
>
>
>
> I have created a 2x2 rectangle by using:
>
>
>
> a<-0:1/10
>
> b<-0:1/10
>
> kk<-expand.grid(a,b)
>
> plot.new()
>
> rect(kk[, 1], kk[, 2], kk[, 1] + .1,kk[, 2] + .1)
>
>
>
>
>
> so how do we put the value of rbind(1:2,1:2) into the relevant cell of this
> rectangle created above? If it is not possible to do so, is there any way to
> plot the matrix table with grid.
>
>    
Hi Rene,
Have a look at the color2D.matplot function in the plotrix package, in 
particular the show.values argument.

Jim




More information about the R-help mailing list