3D scatter plot not drawn by z-axis order when alpha != 1
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
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)
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided plot_ly 3D scatter example with alpha = 0.9 and rotate it to compare depth ordering with alpha = 1. Trace the rendering path for z-axis ordering and category-based drawing, then verify that translucent points are occluded by depth rather than category.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- d3js, javascript, r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100