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

4

0 回答 0