From d4e214322481c89ddc857f8ba2f3fb24e65143c5 Mon Sep 17 00:00:00 2001 From: cpsievert Date: Fri, 14 Aug 2015 14:23:31 -0700 Subject: [PATCH] get_domains() sometimes returns a df of different dimensions from p_info --- R/subplots.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/subplots.R b/R/subplots.R index 2887085f29..ab9bf2100f 100644 --- a/R/subplots.R +++ b/R/subplots.R @@ -75,12 +75,13 @@ subplot <- function(..., nrows = 1, which_layout = "merge", margin = 0.02) { # bump x/y axis anchors appropriately p_info$xaxis <- sub("x1", "x", paste0("x", p_info$key)) p_info$yaxis <- sub("y1", "y", paste0("y", p_info$key)) - # Only do domain computations if they are _completely_ missing # (I don't think it makes sense to support partial specification of domains) if (all(is.na(with(p_info, c(xstart, xend, ystart, yend))))) { - p_info[c("xstart", "xend", "yend", "ystart")] <- - get_domains(max(p_info$key), nrows, margin) + doms <- get_domains(max(p_info$key), nrows, margin) + doms$plot <- as.character(seq_len(nrow(doms))) + p_info <- p_info[!names(p_info) %in% c("xstart", "xend", "ystart", "yend")] + p_info <- plyr::join(p_info, doms, by = "plot") } # empty plot container that we'll fill up with new info p <- list(