Reputation: 6913
I am observing a strange choice from plotly::plot_ly
to color the error bars when a group coloring is specified:
library("data.table")
library("plotly")
dat <- data.table(
low_diff = c(2, 3, 1)
, high_diff = c(3, 4, 1)
, point = c(10, 11, 9)
, type = LETTERS[1:3]
)
plot_ly(data = dat, y = type, x = point, mode = "markers", color = type,
error_x = list(type = "data", symmetric = FALSE,
array = high_diff, arrayminus = low_diff))
How can I specify that each point should have the same color as its error bar?
Upvotes: 0
Views: 504
Reputation: 17611
Where you have color = type
, switch to group = type
to get the desired grouping.
plot_ly(data = dat, y = type, x = point, mode = "markers", group = type,
error_x = list(type = "data", symmetric = FALSE,
array = high_diff, arrayminus = low_diff))
Upvotes: 1