0

I would like to add a grid to a subplot. I am using graphics (and not ggplot2) Say I have a 2x2 plot and I want to plot the grid in c(1,2) plot:

library(gridExtra)                                                                                  
set.seed(1)                                                                                         
rndData <- rnorm(1000)                                                                              
DF <- data.frame(name=paste('name',1:4),value=paste('value',1:4))                                   
#make a (2,2) plot                                                                                  
par(mfrow=c(2,2))                                                                                   
plot(rndData)                                                                                       
plot.new()                                                                                          
plot(rndData)                                                                                       
plot(rndData) 

I'd like the grid in the missing plot enter image description here

But when I am adding the grid...

par(mfrow=c(2,2))                                                                                   
plot(rnddata)                                                                                       
grid.table(DF)                                                                                      
plot(rnddata)                                                                                       
plot(rnddata)

I am getting the ugly :
enter image description here

How can I make sure I place it correctly ? Regards

statquant
  • 13,672
  • 21
  • 91
  • 162
  • See also [**here**](http://stackoverflow.com/questions/19838514/positioning-plots-and-table) and [**here**](http://stackoverflow.com/questions/19145301/adding-a-text-only-panel-to-base-graphics-layout/19208219#19208219). – Henrik Jan 25 '15 at 16:06
  • the second is pretty useless but the first is good. Thanks – statquant Jan 25 '15 at 16:30
  • I just added the link to point to (_potential_) alternatives to `gridExtra` for the R toolbox, e.g. `gplots` and `plotrix`. Good luck! – Henrik Jan 25 '15 at 16:34

0 Answers0