plotly / plotly/plotly.R

Bubble plot still ignores size constraints for singleton color categories

未关闭
#2,068 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

As you can see in the following reprex, the sizing options get ignored for the singleton category (color == "D"); commit https://github.com/plotly/plotly.R/commit/306b4ef057631f9d3200fdfce636696bc0268952 seemed intended to fix this issue but it persists.

library(plotly)
library(dplyr)

dat = structure(list(color = c("A", "A", "A", "B", "B", "C", "C", "D"
), size = c(2L, 1L, 1L, 803L, 254L, 339L, 261L, 577L), x = c(0, 
0, 0, 32.9, 52, 20.4, 33.3, 73.7), y = c(0, 0, 0, 0.7, 0.8, 0.6, 
0, 0.2)), row.names = c(NA, -8L), class = c("tbl_df", "tbl", 
"data.frame"))

print(dat)

desired_maximum_marker_size = 10
sizeref <- 2 * max(dat$size) / (desired_maximum_marker_size^2)

plotly::plot_ly(
    data = dat,
    y = ~y,
    x = ~x,
    color = ~color,
    type = "scatter",
    mode = 'markers',
    sizes = c(1, desired_maximum_marker_size),
    marker = list(
      size = ~size,
      sizemin = 1,
      sizemax = 10,
      opacity = 0.7, 
      sizeref = sizeref,
      sizemode = 'area')
    
  )

newplot

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

运行提供的 R reprex 和 plotly,并确认只有一个观测值的颜色类别忽略了标记大小约束。跟踪颜色类别只有一个观测值时标记大小的处理方式,然后添加一个覆盖该情况的回归测试。完成的标准是,只有一个观测值的类别以与其他类别一致的方式遵守 sizemin、sizemax、sizeref 和 sizemode。

由索引模型根据 Issue 内容生成。

评估

技术栈
r
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。