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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Not sure what a chequerboard plot is, but here is perhaps a start for what you want:> image(t(junk), axes = F) > pu <- par("usr") > abline(v = seq(pu[1], pu[2], len=6), h = seq(pu[3], pu[4], len=6))It would be easy to make this into a general function (as you will find, no doubt)! Bill Venables -----Original Message----- From: Andy Bunn [mailto:abunn at montana.edu] Sent: Saturday, May 18, 2002 2:24 PM To: r-help at stat.math.ethz.ch Subject: [R] checkerboard plot? 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
image(junk) should work. See ?image for how to change colors etc. --- Andy Bunn <abunn at montana.edu> 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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ __________________________________________________ LAUNCH - Your Yahoo! Music Experience -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._