【问题标题】:plotly error bar plot strange color scheme情节错误条情节奇怪的配色方案
【发布时间】:2016-08-29 17:43:26
【问题描述】:

我观察到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))

如何指定每个点的颜色应与其误差线相同?

【问题讨论】:

  • @Jota 发布答案?
  • @Jota 是的,绝对是,继续发帖,我会接受

标签: r plot plotly


【解决方案1】:

如果您有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))

【讨论】:

    猜你喜欢
    • 2018-10-07
    • 2013-01-10
    • 2016-11-29
    • 1970-01-01
    • 2022-01-21
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 2019-03-29
    相关资源
    最近更新 更多