[R] Deleting the White Space in an R graph

Greg Snow Greg.Snow at intermountainmail.org
Wed Oct 10 23:24:51 CEST 2007


The squishplot function in the TeachingDemos package will move the axes
and other annotation closer to the plot so there is less whitespace
within the plot region (there will still be whitespace in the margin
areas beyond the axes and labels).  Is this what you want?

To completely eliminate all the whitespace you will need to set up your
graphics device to the correct size (the computations done in squishplot
may help) and set the margins to only include enough room for what you
intend to put there.  One possible approach for this is:

1. plot using squishplot
2. use the locator function and click on the edges of what you want in
the graph
3. use cnvrt.coords (also in TeachingDemos) to convert the results from
locator to device coordinates
4. start up your graphics device with the height and width proportional
to the result from 3
5. use par(mar=c(...  And put in just enough room for the annotations
you will use.
6. create your plot 
7. if it does not match what you want, then adjust accordingly and
repeat.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of nalluri pratap
> Sent: Wednesday, October 10, 2007 12:58 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Deleting the White Space in an R graph
> 
> Hi All,
>    
>   Is there a way we can delete the empty white space around 
> when we generate any graph/map using R? The final output 
> should be onaly a picture with no white spaces all around.
>    
>   Cheers,
>   Pratap
> 
>        
> ---------------------------------
>  5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
> 



More information about the R-help mailing list