Skip to content

Commit 92cf0d9

Browse files
committed
margin of 0 wasn't a good idea
1 parent d26c8ac commit 92cf0d9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

R/subplots.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
## TODO: throw warning if geo and non-geo coordinates are used!!!
25-
subplot <- function(..., nrows = 1, which_layout = "merge", margin = 0) {
25+
subplot <- function(..., nrows = 1, which_layout = "merge", margin = 0.1 /nrows) {
2626
# note that dots is a _list of plotlys_
2727
dots <- lapply(list(...), plotly_build)
2828
# put existing plot anchors and domain information into a tidy format

tests/testthat/test-plotly-subplot.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ context("subplot")
22

33
expect_traces <- function(p, n.traces, name){
44
stopifnot(is.numeric(n.traces))
5-
L <- save_outputs(p, paste0("plotly-subplot", name))
5+
L <- save_outputs(p, paste0("plotly-subplot-", name))
66
expect_equal(length(L$data), n.traces)
77
L
88
}
@@ -14,7 +14,7 @@ test_that("simple subplot works", {
1414
expect_identical(s$data[[2]]$xaxis, s$layout[["yaxis2"]][["anchor"]])
1515
expect_identical(s$data[[2]]$yaxis, s$layout[["xaxis2"]][["anchor"]])
1616
doms <- lapply(s$layout, "[[", "domain")
17-
expect_true(doms$xaxis[2] < doms$xaxis2[1])
17+
expect_true(doms$xaxis[2] <= doms$xaxis2[1])
1818
})
1919

2020
test_that("nrows argument works", {
@@ -24,7 +24,7 @@ test_that("nrows argument works", {
2424
expect_identical(s$data[[2]]$xaxis, s$layout[["yaxis2"]][["anchor"]])
2525
expect_identical(s$data[[2]]$yaxis, s$layout[["xaxis2"]][["anchor"]])
2626
doms <- lapply(s$layout, "[[", "domain")
27-
expect_true(doms$yaxis[1] > doms$yaxis2[2])
27+
expect_true(doms$yaxis[1] >= doms$yaxis2[2])
2828
})
2929

3030

0 commit comments

Comments
 (0)