For a categorical colour aesthetic, there appears to be no documented way to use selectedpoints to select individual points.
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
The following example highlights the first point from each colour group (the first "a" point and the first "b" point):
library(plotly)
d <- data.frame(x = 1:4, c = c("a", "a", "b", "b"))
plot_ly(d) |>
add_trace(x=~x, y = ~x, color = ~c, type = "scatter", selectedpoints = list(0))
From the plot_ly() documentation, it appears that this code implicitly creates multiple traces, one for each colour, so this behaviour makes sense on this level (even if it's surprising). However, there appears to be no documented way to access individual traces. I've tried a number of permutations
In my opinion, if the code is going to transparently create multiple traces like that, it should also transparently map selectedpoints provided by the user (ideally as 1-based indexes or logical vectors, for consistency with R) to their positions within each trace.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 plot_ly() 文档和分类颜色示例开始,追踪 colour 如何创建单独的 trace,以及 selectedpoints 如何传递。完成的标准是提供一种有文档说明且一致的方式,用于选择每个生成的 trace 中的点,并覆盖所示示例和提议的 R-style 索引行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100