plotly error bar plot 奇怪的配色方案
plotly error bar plot strange color scheme
我观察到 plotly::plot_ly
的一个奇怪选择,在指定组着色时为误差线着色:
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))
如何指定每个点的颜色应与其误差条相同?
在您有 color = type
的地方,切换到 group = type
以获得所需的分组。
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))
我观察到 plotly::plot_ly
的一个奇怪选择,在指定组着色时为误差线着色:
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))
如何指定每个点的颜色应与其误差条相同?
在您有 color = type
的地方,切换到 group = type
以获得所需的分组。
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))