diff --git a/R/utils.R b/R/utils.R
index 3d39576bd7..6b573eb95b 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -348,7 +348,7 @@ supply_defaults <- function(p) {
p$x$layout[[p$x$layout$mapType]] <- modify_list(
list(domain = geoDomain), p$x$layout[[p$x$layout$mapType]]
)
- } else {
+ } else if (!length(p$x$layout[["grid"]])) {
types <- vapply(p$x$data, function(tr) tr[["type"]] %||% "scatter", character(1))
axes <- unlist(lapply(types, function(x) {
grep("^[a-z]axis$", names(Schema$traces[[x]]$attributes), value = TRUE) %||% NULL
diff --git a/tests/figs/plotly/errorbar-width.svg b/tests/figs/plotly/errorbar-width.svg
new file mode 100644
index 0000000000..350b49d1fa
--- /dev/null
+++ b/tests/figs/plotly/errorbar-width.svg
@@ -0,0 +1 @@
+
diff --git a/tests/figs/plotly/layout-grid.svg b/tests/figs/plotly/layout-grid.svg
new file mode 100644
index 0000000000..22684dbebb
--- /dev/null
+++ b/tests/figs/plotly/layout-grid.svg
@@ -0,0 +1 @@
+
diff --git a/tests/figs/size/marker-size.svg b/tests/figs/size/marker-size.svg
new file mode 100644
index 0000000000..f94c4e025a
--- /dev/null
+++ b/tests/figs/size/marker-size.svg
@@ -0,0 +1 @@
+
diff --git a/tests/figs/size/sizemode.svg b/tests/figs/size/sizemode.svg
new file mode 100644
index 0000000000..86f61e2bb5
--- /dev/null
+++ b/tests/figs/size/sizemode.svg
@@ -0,0 +1 @@
+
diff --git a/tests/figs/subplot/plotly-subplot-shareboth.svg b/tests/figs/subplot/plotly-subplot-shareboth.svg
index e2d7d2e59e..ac0bc8f7f2 100644
--- a/tests/figs/subplot/plotly-subplot-shareboth.svg
+++ b/tests/figs/subplot/plotly-subplot-shareboth.svg
@@ -1 +1 @@
-
+
diff --git a/tests/testthat/test-plotly.R b/tests/testthat/test-plotly.R
index 803c18284d..dcbf77bfe3 100644
--- a/tests/testthat/test-plotly.R
+++ b/tests/testthat/test-plotly.R
@@ -280,3 +280,18 @@ test_that("Can map data to legendgroup", {
expect_true(bars[[i]]$legendgroup == letters[[i]])
}
})
+
+
+test_that("Axis domains aren't supplied if layout.grid exists", {
+ p <- plot_ly(type = 'scatter',mode = 'lines', y = c(5,1,3), xaxis = 'x', yaxis = 'y') %>%
+ add_trace(y = c(2,1,5), xaxis = 'x2', yaxis = 'y2') %>%
+ add_trace(y = c(2,1,5), xaxis = 'x3', yaxis = 'y3')%>%
+ add_trace(y = c(2,1,5), xaxis = 'x4', yaxis = 'y4')%>%
+ add_trace(y = c(2,1,5), xaxis = 'x5', yaxis = 'y5')%>%
+ add_trace(y = c(2,1,5), xaxis = 'x6', yaxis = 'y6')%>%
+ layout(grid = list(rows = 2, columns = 3, pattern ='independent'))
+
+ l <- expect_doppelganger_built(p, "layout-grid")
+ expect_null(l$layout$xaxis$domain)
+ expect_null(l$layout$yaxis$domain)
+})