Skip to content

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

2 messages · Mark Heckmann, Paul Murrell

#
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
#
Hi
Mark Heckmann wrote:
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