Mark Heckmann
2009-Apr-08 09:00 UTC
[R] does grid.rect() not accept NULL argument from gpar(col=NULL) ?
I want to draw a grid rectangle without a border. ?gpar says: "Specifying the value NULL for a parameter is the same as not specifying any value for that parameter, except for col and fill, where NULL indicates not to draw a border or not to fill an area (respectively)." pushViewport(viewport(height=unit(.8, "npc"))) grid.rect(gp=gpar(col=NULL, fill="green")) popViewport() Still a border is drawn. What am I doing wrong? TIA, Mark
Paul Murrell
2009-Apr-08 21:02 UTC
[R] does grid.rect() not accept NULL argument from gpar(col=NULL) ?
Hi Mark Heckmann wrote:> I want to draw a grid rectangle without a border. > > ?gpar says: > > "Specifying the value NULL for a parameter is the same as not specifying any > value for that parameter, except for col and fill, where NULL indicates not > to draw a border or not to fill an area (respectively)." > > pushViewport(viewport(height=unit(.8, "npc"))) > grid.rect(gp=gpar(col=NULL, fill="green")) > popViewport() > > Still a border is drawn. What am I doing wrong?Your mistake was to assume that the documentation is correct! :) That behaviour is actually WAY out of date. You can do what you want using NA ... pushViewport(viewport(height=unit(.8, "npc"))) grid.rect(gp=gpar(col=NA, fill="green")) popViewport() Thanks for reporting the problem (the docs are now fixed). Paul> TIA, Mark > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/