Skip to content

Commit 257a0c1

Browse files
committed
Merge pull request #266 from ropensci/fix-subplot
Bug fix for subplot()
2 parents c6eb180 + d4e2143 commit 257a0c1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/subplots.R

+4-3
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ subplot <- function(..., nrows = 1, which_layout = "merge", margin = 0.02) {
7575
# bump x/y axis anchors appropriately
7676
p_info$xaxis <- sub("x1", "x", paste0("x", p_info$key))
7777
p_info$yaxis <- sub("y1", "y", paste0("y", p_info$key))
78-
7978
# Only do domain computations if they are _completely_ missing
8079
# (I don't think it makes sense to support partial specification of domains)
8180
if (all(is.na(with(p_info, c(xstart, xend, ystart, yend))))) {
82-
p_info[c("xstart", "xend", "yend", "ystart")] <-
83-
get_domains(max(p_info$key), nrows, margin)
81+
doms <- get_domains(max(p_info$key), nrows, margin)
82+
doms$plot <- as.character(seq_len(nrow(doms)))
83+
p_info <- p_info[!names(p_info) %in% c("xstart", "xend", "ystart", "yend")]
84+
p_info <- plyr::join(p_info, doms, by = "plot")
8485
}
8586
# empty plot container that we'll fill up with new info
8687
p <- list(

0 commit comments

Comments
 (0)