[R] how to remove border while saving R plots ?

David Winsemius dwinsemius at comcast.net
Mon Nov 8 14:47:17 CET 2010

On Nov 8, 2010, at 5:13 AM, vikrant wrote:

> I am saving R graph as a jpeg image and the border is plotted  
> defaultly when
> you open the image.How can I avoid the border?
> small R code is as follows :-
> volume<- seq(100,10,-10)
>           jpeg(filename =  
> "mygraph.jpg",width=366,height=284,units="px")
> 	{
> 		pie(volume,main=title,radius=radius ,bty="n",clockwise =  
> TRUE,col=color,
> 		font.main = 2,cex.main = 1.8,cex.lab=1.5,border = FALSE)
> 	}
> 	dev.off()
> when I open this image  automaticaly border is  plotted around the  
> graph.
> How to avoid this?

Read the help pages? The pie help page Argument definition for border  
refers you to the polygon help page... see that handy little link?

the color to draw the border. The default, NULL, means to use  
par("fg"). Use border = NA to omit borders."

I get an error complaining about missing a "color" vector when I try  
to test border=NA  with your code, but presumably a more complete  
example would have demonstrated success. (  I did try putting in  
something for col= but then "radius" was also missing so back to you,  


David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list