I am trying to come up with a way of shading-in a grid for a simple pattern So far I can draw a square where I want but I cannot seem to draw a complete grid. I am just drawing them along the diagonal!! Clearly I am missing something simple but what? Any suggestions gratefully accepted. Example #===================================================================op <- par(xaxs="i", yaxs="i") plot(c(1, 11), c(1,11), type ="n", xlab="", ylab="") x1 <- rep(1:10, each=10) x2 <- rep(2:11, each=10) y1 <- rep(1:10, each=10) y2 <- rep(2:11, each=10) # no grid :( rect(x1,y1,x2,y2, border="blue") rect(2,2,3,3, col="red") x1 <- rep(1:10,10) x2 <- rep(2:11, 10) y1 <- rep(1:10, 10) y2 <- rep(2:11, 10) # no grid again :( rect(x1,y1,x2,y2, border="blue") par <- op #==================================================================== __________________________________________________________________ The new Internet Explorer? 8 - Faster, safer, easier. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
On Aug 24, 2009, at 4:10 PM, John Kane wrote:> I am trying to come up with a way of shading-in a grid for a simple > pattern > > So far I can draw a square where I want but I cannot seem to draw a > complete grid. I am just drawing them along the diagonal!! > > Clearly I am missing something simple but what? > > Any suggestions gratefully accepted. > > Example > #===================================================================> op <- par(xaxs="i", yaxs="i") > plot(c(1, 11), c(1,11), type ="n", xlab="", ylab="")plot(c(1, 11), c(1,11), type ="n", xlab="", ylab="") abline(h=2:10, lty=3, col="red") abline(v=2:10, lty=3, col="red") Is that what you meant be a "complete grid"? -- David Winsemius, MD Heritage Laboratories West Hartford, CT
On Aug 24, 2009, at 4:10 PM, John Kane wrote:> I am trying to come up with a way of shading-in a grid for a simple > pattern > > So far I can draw a square where I want but I cannot seem to draw a > complete grid. I am just drawing them along the diagonal!! > > Clearly I am missing something simple but what? > > Any suggestions gratefully accepted. > > Example > #===================================================================> op <- par(xaxs="i", yaxs="i") > plot(c(1, 11), c(1,11), type ="n", xlab="", ylab="")# and of course you suggested using grid() so ... grid(10,10, col="blue")> par <- op > > #====================================================================David Winsemius, MD Heritage Laboratories West Hartford, CT
ARGGH! I knew I was missing something simple!! It was just too obvious. Many thanks. --- On Mon, 8/24/09, David Winsemius <dwinsemius at comcast.net> wrote:> From: David Winsemius <dwinsemius at comcast.net> > Subject: Re: [R] plotting a grid with grid() ? > To: "John Kane" <jrkrideau at yahoo.ca> > Cc: "R R-help" <r-help at stat.math.ethz.ch> > Received: Monday, August 24, 2009, 5:14 PM > > On Aug 24, 2009, at 4:10 PM, John Kane wrote: > > > I am trying to come up with a way of shading-in a grid > for a simple pattern > > > > So far I can draw a square where I want but I cannot > seem to draw a complete grid. I am just drawing them along > the diagonal!! > > > > Clearly I am missing something simple but what? > > > > Any suggestions gratefully accepted. > > > > Example > > > #===================================================================> > op <-? par(xaxs="i", yaxs="i") > > plot(c(1, 11), c(1,11), type ="n", xlab="", ylab="") > > # and of course you suggested using grid() so ... > > grid(10,10, col="blue") > > > par <- op > > > > > #====================================================================> > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > >__________________________________________________________________ Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now http://ca.toolbar.yahoo.com.
That is what I wanted but grid(10,10) works just fine too Thanks again. --- On Mon, 8/24/09, David Winsemius <dwinsemius at comcast.net> wrote:> From: David Winsemius <dwinsemius at comcast.net> > Subject: Re: [R] plotting a grid with grid() ? > To: "John Kane" <jrkrideau at yahoo.ca> > Cc: "R R-help" <r-help at stat.math.ethz.ch> > Received: Monday, August 24, 2009, 4:37 PM > > On Aug 24, 2009, at 4:10 PM, John Kane wrote: > > > I am trying to come up with a way of shading-in a grid > for a simple pattern > > > > So far I can draw a square where I want but I cannot > seem to draw a complete grid. I am just drawing them along > the diagonal!! > > > > Clearly I am missing something simple but what? > > > > Any suggestions gratefully accepted. > > > > Example > > > #===================================================================> > op <-? par(xaxs="i", yaxs="i") > > plot(c(1, 11), c(1,11), type ="n", xlab="", ylab="") > > plot(c(1, 11), c(1,11), type ="n", xlab="", ylab="") > abline(h=2:10, lty=3, col="red") > abline(v=2:10, lty=3, col="red") > > Is that what you meant be a "complete grid"? > > --David Winsemius, MD > Heritage Laboratories > West Hartford, CT > >__________________________________________________________________ Make your browsing faster, safer, and easier with the new Internet Explorer? 8. Optimized for Yahoo! Get it Now for Free!