Skip to content

Commit

Permalink
improvements to plot
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Oct 25, 2024
1 parent 2e42a22 commit 5805a64
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions R/gtable.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,15 @@ dimnames.gtable <- function(x, ...) list(x$rownames, x$colnames)
}

#' @export
plot.gtable <- function(x, ...) {
plot.gtable <- function(x, bg = NULL, grill = NULL, ...) {
grid.newpage()
grid.rect(gp = gpar(fill = "grey95"))
grid <- seq(0, 1, length.out = 20)
grid.grill(h = grid, v = grid, gp = gpar(col = "white"))
if (!is.null(bg)) {
grid.rect(gp = gpar(fill = bg))
}
if (!is.null(grill)) {
grid <- seq(0, 1, length.out = 20)
grid.grill(h = grid, v = grid, gp = gpar(col = grill))
}
grid.draw(x)
}

Expand Down

0 comments on commit 5805a64

Please sign in to comment.