[R] How to get a grid behind a boxplot
    Toby Popenfoose 
    tpopenfoose at earthlink.net
       
    Sat Apr 29 01:46:52 CEST 2006
    
    
  
I am using R 2.2.1 on a Windows 2000 PC.  
When I do a grid() after the boxplot 
it overprints the boxplot:
> boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
> grid(nx=NA, ny=NULL)
>
if I try the panel.first
> boxplot(count ~ spray, data = InsectSprays, col = "lightgray",
+         panel.first=grid(nx=NA, ny=NULL))
> 
I can see the grid flash and go away.  
If I close the device and then try the panel.first,
I do not get a boxplot and the following error message:
> boxplot(count ~ spray, data = InsectSprays, col = "lightgray",
+         panel.first=grid(nx=NA, ny=NULL))
Error in abline(h = at, col = col, lty = lty, lwd = lwd) : 
 plot.new has not been called yet
> 
Same thing when I try pdf device:
> pdf("test.pdf")
> boxplot(count ~ spray, data = InsectSprays, col = "lightgray",
+         panel.first=grid(nx=NA, ny=NULL))
Error in abline(h = at, col = col, lty = lty, lwd = lwd) : 
 plot.new has not been called yet
> dev.off()
null device 
          1 
How can I get the grid behind the boxplot?
Thank you,
Toby Popenfoose
Donnelley Manufacturing Supervisor
tpopenfoose at earthlink.net
    
    
More information about the R-help
mailing list