[R] checkerboard plot?

Laurent Gautier laurent at cbs.dtu.dk
Sat May 18 08:57:54 CEST 2002


Would the following do it ?

m <- matrix(0:1, 5,5)
image(m, col=c("white", "black"))


Hopin' it helps,



L.




On Fri, May 17, 2002 at 10:24:28PM -0600, Andy Bunn wrote:
> Hi,
> 
> I've been doing a lot of CA modeling lately and am now wanting to make some
> checkerboard plots in R.
> 
> Let's say I have a matrix:
> 
> > is.matrix(junk)
> [1] TRUE
> > junk
>      [,1] [,2] [,3] [,4] [,5]
> [1,]    0    0    1    0    0
> [2,]    0    1    1    1    0
> [3,]    0    1    0    0    1
> [4,]    0    1    1    1    1
> [5,]    0    1    0    0    0
> >
> 
> and I want to make a checkerboard with 0 being white and 1 being black.
> 
> Any thoughts on how I wuld do this?
> 
> Thanks in advance,
> Andy
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list