I have this piece of code that works fine in 3.x but not in the 4.x dev version. In fact, subplot in 3.x actually changes the colors of the plots, which is also broken in 4.x.
p1 <- plot_ly(filter(mtcars, am == 1), x = mpg, type = 'histogram', histnorm = 'probability',
xbins = list(start = 0, end = max(mtcars$mpg) + 5,
size = 3),
autobinx = FALSE, showlegend = FALSE)
p2 <- plot_ly(filter(mtcars, am == 0), x = mpg, type = 'histogram', histnorm = 'probability',
xbins = list(start = 0, end = max(mtcars$mpg) + 5,
size = 3),
autobinx = FALSE, showlegend = FALSE)
p <- plotly::subplot(p1, p2, nrows = 2, shareY = TRUE, shareX = TRUE)
p %>% layout(annotations = list(
list(x = 0.5 , y = 1.05, text = 'Automatic', showarrow = F,
xref = 'paper', yref = 'paper'),
list(x = 0.5, y = 0.45, text = 'Manual', showarrow = F,
xref = 'paper', yref = 'paper')))
I have this piece of code that works fine in 3.x but not in the 4.x dev version. In fact, subplot in 3.x actually changes the colors of the plots, which is also broken in 4.x.
Any idea on how to get annotations to work with subplot?