This question is obviously a replicate from this thread .
However I could not apply the solution given in the comments, hence my question.
I want to use user-defined colors to fill box plots with plotly.
In the following code I would expect the boxes to be filled respectively with red and blue, but they keep the default colors.
library(plotly)
d1 <- data.frame(val = rnorm(n=1000), type=1)
d2 <- data.frame(val = rnorm(n=1000), type=2)
col1 <- "red"
col2 <- "blue"
plot_ly() %>%
add_trace(data = d1, y = ~val, type="box", colors=col1) %>%
add_trace(data = d2, y = ~val, type="box", colors=col2)
I have managed to change the lines' and markers' colors, but not the fill.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.