Black Lives Matter. Please consider donating to Black Girls Code today.

Subplots not equal size

Hi amazing Plotly team, and community users!

I have found out that for some reason the subplot code in R causes the outer corner plots to be a different size than the inner plots. Any idea how to fix this without specifying size for every column and row ?

str(mtcars)
mtcars2 <- mtcars
mtcars2$cyl <- mtcars2$cyl +10
mtcars3 <- mtcars
mtcars3$cyl <- mtcars3$cyl +20

mtcarsBig <- rbindlist(list(mtcars, mtcars2, mtcars3))

mtcarsBig %>%
split(mtcarsBig$cyl) %>%
purrr::map(., function(x) {
plot_ly(data = x,
x = rownames(x),
y = ~mpg,
type = β€œbar”) %>%
layout( )
}) %>%
subplot(nrows = 3, margin = 0.03)

1 Like