|
32 | 32 | subplot <- function(..., nrows = 1, widths = NULL, heights = NULL, margin = 0.02,
|
33 | 33 | shareX = FALSE, shareY = FALSE, titleX = shareX,
|
34 | 34 | titleY = shareY, which_layout = "merge") {
|
| 35 | + # are the dots a list of plotly objects? |
| 36 | + dotz <- list(...) |
| 37 | + if (length(dotz) == 1 && is.list(dotz) && !is.plotly(dotz)) { |
| 38 | + dotz <- dotz[[1]] |
| 39 | + } |
35 | 40 | # build each plot
|
36 |
| - plotz <- lapply(list(...), plotly_build) |
| 41 | + plotz <- lapply(dotz, plotly_build) |
37 | 42 | # ensure "axis-reference" trace attributes are properly formatted
|
38 | 43 | # TODO: should this go inside plotly_build()?
|
39 | 44 | plotz <- lapply(plotz, function(p) {
|
@@ -245,8 +250,8 @@ get_domains <- function(nplots = 1, nrows = 1, margins = 0.01,
|
245 | 250 | "to the number of columns", call. = FALSE)
|
246 | 251 | }
|
247 | 252 | if (length(heights) != nrows) {
|
248 |
| - stop("The length of the heights argument must be equal ", |
249 |
| - "to the number of rows", call. = FALSE) |
| 253 | + stop("The length of the heights argument is ", length(heights), |
| 254 | + ", but the number of rows is ", nrows, call. = FALSE) |
250 | 255 | }
|
251 | 256 | if (any(widths < 0) | any(heights < 0)) {
|
252 | 257 | stop("The widths and heights arguments must contain positive values")
|
|
0 commit comments