plotly / plotly/plotly.R

3D scatter plot not drawn by z-axis order when alpha != 1

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

还没有人认领这个 Issue。

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

描述

When creating a 3D scatter plot, the dots should be drawn in the order of depth, so drawing the furthest dot first, to get the right occlusion. This works well when alpha = 1, but when alpha < 1 the dots seem to be drawn in order of categories instead.

Here's a simple example. If you rotate it so the green dot is at the forefront, it is nevertheless occluded by the blue dot:

library(plotly)
plot_ly(data = data.frame(x = c(1, 1),
                          y = c(1, 2), 
                          z = c(1, 1), 
                          class = c("A", "B")),
        x = ~x, 
        y = ~y, 
        z = ~z, 
        color = ~class,
        alpha = 0.9)

Capture

This especially problematic when you have a lot of dots, and a cluster of nearby dots is completely hidden by a faraway cluster of dots of a different color.

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] plotly_4.10.0 ggplot2_3.3.5

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7         pillar_1.6.4       compiler_4.0.3     later_1.3.0        RColorBrewer_1.1-2 tools_4.0.3        digest_0.6.28     
 [8] viridisLite_0.4.0  jsonlite_1.7.2     lifecycle_1.0.1    tibble_3.1.5       gtable_0.3.0       pkgconfig_2.0.3    rlang_0.4.11      
[15] shiny_1.7.1        DBI_1.1.1          crosstalk_1.1.1    yaml_2.2.1         fastmap_1.1.0      httr_1.4.2         withr_2.4.2       
[22] dplyr_1.0.7        htmlwidgets_1.5.4  generics_0.1.0     vctrs_0.3.8        grid_4.0.3         tidyselect_1.1.1   data.table_1.14.2 
[29] glue_1.4.2         R6_2.5.1           fansi_0.5.0        farver_2.1.0       tidyr_1.1.4        purrr_0.3.4        magrittr_2.0.1    
[36] scales_1.1.1       promises_1.2.0.1   ellipsis_0.3.2     htmltools_0.5.2    assertthat_0.2.1   mime_0.12          colorspace_2.0-2  
[43] xtable_1.8-4       httpuv_1.6.3       utf8_1.2.2         lazyeval_0.2.2     munsell_0.5.0      crayon_1.4.1   

贡献指南

打开贡献指南

从这里开始

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

调研方向

使用 alpha = 0.9 重现提供的 plot_ly 3D 散点图示例,并旋转它,以便将深度排序与 alpha = 1 进行比较。跟踪 z 轴排序和基于类别的绘制的渲染路径,然后验证半透明点是被深度而不是类别遮挡的。

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

评估

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

把新 issue 发到你的邮箱

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