Skip to content

Retrain color defaults in subplot #724

@gtumuluri

Description

@gtumuluri

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')))

Any idea on how to get annotations to work with subplot?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions