Skip to content

boxplot: specification color bounding box #1292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lcougnaud opened this issue Jun 25, 2018 · 1 comment
Closed

boxplot: specification color bounding box #1292

lcougnaud opened this issue Jun 25, 2018 · 1 comment
Labels

Comments

@lcougnaud
Copy link

lcougnaud commented Jun 25, 2018

I would like to set the color of the line bounding the box of a boxplot.
It is mentioned in the documentation that the 'color' parameter via the 'line' parameter is available for this purpose.
However, it seems that this color overwrites the filling color of the boxplot when used in combination with the 'color' parameter:

data <- data.frame(x = rep(c("A", "B"), each = 5), y = rnorm(10))
plot_ly(data) %>% 
add_boxplot(x = ~x, y = ~y, color = ~x, colors = c('A' = "blue", 'B' = "red")

newplot

data <- data.frame(x = rep(c("A", "B"), each = 5), y = rnorm(10))
plot_ly(data) %>% 
add_boxplot(x = ~x, y = ~y, color = ~x, colors = c('A' = "blue", 'B' = "red"), line = list(color = "black"))

newplot 1
Is there an alternative specification to obtain colored boxplot based on a variable, with line set to a fixed color?
Thanks in advance

@cpsievert
Copy link
Collaborator

cpsievert commented Nov 1, 2018

Yea, this is related to a bug in plot_ly(). That, or the following, should work the way you expect

plot_ly(data) %>% 
    add_boxplot(x = ~x, y = ~y, color = ~x, colors = c('A' = "blue", 'B' = "red"), stroke = I("black"))

Follow #1388 for progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants