Scatter points at wrong coordinates when combining multicategory axis and colour
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hi,
When combining a multicategory axis and colour coding in a scatter plot, the mapping of the points seem to go wrong.
In p2 in the example below, the points appear at coordinates that are not in the data.
The problem can be resolved by first ordering the data (p4).
library(plotly)
d <- data.frame(
l1 = letters[11:15],
l2 = c('a', 'a', 'a', 'a', 'b'),
y = 1:10,
col = LETTERS[11:15],
stringsAsFactors = F
)
p1 <- plot_ly(
data = d,
x = list(~l2, ~l1),
y = ~y,
# color = ~col,
type = 'scatter',
mode = 'markers'
)
p2 <- plot_ly(
data = d,
x = list(~l2, ~l1),
y = ~y,
color = ~col,
type = 'scatter',
mode = 'markers'
)
d <- d[order(d$l1), ]
p3 <- plot_ly(
data = d,
x = list(~l2, ~l1),
y = ~y,
# color = ~col,
type = 'scatter',
mode = 'markers'
)
p4 <- plot_ly(
data = d,
x = list(~l2, ~l1),
y = ~y,
color = ~col,
type = 'scatter',
mode = 'markers'
)
subplot(p1, p2, p3, p4, nrows = 2, margin = .07) %>%
layout(annotations = list(
list(x = 0.1 , y = 1.05, text = "unordered/uncolored", showarrow = F, xref='paper', yref='paper'),
list(x = 0.9 , y = 1.05, text = "unordered/colored", showarrow = F, xref='paper', yref='paper'),
list(x = 0.1 , y = .45, text = "ordered/uncolored", showarrow = F, xref='paper', yref='paper'),
list(x = 0.9 , y = .45, text = "ordered/colored", showarrow = F, xref='paper', yref='paper')
)
)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行提供的可复现 R 示例,并将无序/带颜色的散点图与其他面板进行比较。跟踪多类别轴与颜色结合时的散点处理;当点保持在输入数据中的坐标上且不需要预先排序时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100