[R] does grid.rect() not accept NULL argument from gpar(col=NULL) ?

Paul Murrell p.murrell at auckland.ac.nz
Wed Apr 8 23:02:17 CEST 2009


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/




More information about the R-help mailing list