ivo_welch-rstat8303@mailblocks.com
2005-Aug-09 14:20 UTC
[R] clip to keep coordinate system?
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? regards, /ivo
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