splom does not work with numeric color

未關閉
#2,500 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
r

研究方向

Start by running the reproduction in the issue: a splom from iris via plot_ly(type = "splom", dimensions = ...), first with color = ~Species, which works, then with a numeric color such as color = 1:150, which misaligns the dimensions. The payload does not name the R or JavaScript files that handle splom colouring, so locate them from the plot_ly call path. Done means the numeric-colour splom renders with aligned dimensions, and the factor-colour output is unchanged.

由索引模型根據 Issue 內容生成。

描述

You can create a scatter matrix in R plotly:

library(plotly)

plot_ly(
  iris,
  type = "splom",
  dimensions = lapply(names(iris), function(col) {
    list(
      label = col,
      values = iris[[col]]
    )
  }),
  color = ~Species
)
Image

However the plot does not work if a numeric color is provided:

plot_ly(
  iris,
  type = "splom",
  dimensions = lapply(names(iris), function(col) {
    list(
      label = col,
      values = iris[[col]]
    )
  }),
  color = 1:150 # or iris$Sepal.Width or ~Sepal.Width
)
Image

The dimensions are misaligned.

> sessionInfo()
R version 4.5.0 (2025-04-11 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)

Matrix products: default
  LAPACK version 3.12.1

locale:
[1] LC_COLLATE=German_Germany.utf8  LC_CTYPE=German_Germany.utf8    LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C                    LC_TIME=German_Germany.utf8    

time zone: Europe/Berlin
tzcode source: internal

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

other attached packages:
[1] plotly_4.12.1 ggplot2_3.5.2

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5        httr_1.4.8         cli_3.6.5          rlang_1.1.6        purrr_1.0.4        generics_0.1.4     jsonlite_2.0.0     data.table_1.18.0 
 [9] glue_1.8.0         htmltools_0.5.9    scales_1.4.0       grid_4.5.0         crosstalk_1.2.2    tibble_3.2.1       fastmap_1.2.0      yaml_2.3.12       
[17] lifecycle_1.0.5    compiler_4.5.0     dplyr_1.1.4        RColorBrewer_1.1-3 htmlwidgets_1.6.4  pkgconfig_2.0.3    tidyr_1.3.1        rstudioapi_0.17.1 
[25] farver_2.1.2       digest_0.6.39      viridisLite_0.4.3  R6_2.6.1           tidyselect_1.2.1   pillar_1.11.1      magrittr_2.0.4     tools_4.5.0       
[33] withr_3.0.2        gtable_0.3.6 
主要語言
R
星號
2.7k
分支
641
PR 合併指標
30 天內沒有已合併 PR

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

plotly/plotly.R 的其他 Issue

查看 plotly/plotly.R 的全部 Issue

相似的 Issue

更多 R Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。