Search code examples
rgraphr-grid

R grid.table - table keeps plotting on top of other plots


I'm trying to use grid.table for the first time.
The tables keep plotting on top of what ever is in the plotting window. In other words, it does not create a new Plot display, it just added it onto what ever is there already.
Is there a way to force it to use a new plotting window?

library(grid)
d <- head(iris[,1:3])
plot(d)
grid.table(d)

enter image description herelibrary(gridExtra)


Solution

  • You can use grid.newpage() to get a new page in your panel.

    library(grid)
    d <- head(iris[,1:3])
    plot(d)
    library(gridExtra)
    
    grid.newpage()
    
    grid.table(d)