[R] clip to keep coordinate system?

Thomas Lumley tlumley at u.washington.edu
Tue Aug 9 16:49:36 CEST 2005


On Tue, 9 Aug 2005 ivo_welch-rstat8303 at mailblocks.com wrote:

>
> dear R wizards:
>
> plot( 1, 1, ylim=(2,10), xlim=(2,10), type="n");
> rect( -1, -1, 12, 12, col=gray(0.99) );
>
> unfortunately wipes out the border axes around the plot.  how do I keep
> this?

I think you meant
   plot( 1, 1, ylim=c(2,10), xlim=c(2,10), type="n")
   rect( -1, -1, 12, 12, col=gray(0.99) )
Your code has two syntax errors and two spurious semicolons.

The border axes are gone because you have drawn on top of them.

On the quartz() and pdf() devices you could draw the rectangle in a 
partially transparent color rather than solid light grey.

More generally, you can redraw the border axes with box()

 	-thomas




More information about the R-help mailing list