`colors` argument to `add_trace` is only respected if the trace type *isn't* specified in the `plot_ly` call
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I'd expect these two lines of code to produce the same output, but only the first does what I expect (uses the colors argument to pick a palette for the points):
plot_ly(data = iris) %>%
add_trace(x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species, colors = "Blues", mode = "markers")
plot_ly(data = iris, type="scatter") %>%
add_trace(x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species, colors = "Blues", mode = "markers")
This seems backwards since I added the type="scatter" to avoid the warning about guessing the trace type, only to have my palette disappear.
Curiously, this behavior isn't present if everything is specified in the same call:
plot_ly(data = iris, x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species, colors = "Blues")
plot_ly(data = iris, x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species, colors = "Blues", type="scatter")
both return
Is colors the correct way to pass a palette to a specific layer? In other places it seems like it's actually colorspace? I know scatter doesn't have a colors argument in schema() (e.g. #1699) but clearly it's working when the type is inferred and I would like to provide a palette...
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
iris を使って 2 つの plot_ly/add_trace の例を再現し、生成されたパレットを比較します。plot_ly と add_trace のエントリポイント、特に明示的な type="scatter" パスにおける色の処理を追跡します。両方の呼び出し形式が一貫して colors="Blues" を受け入れ、異なる例に対する回帰テストのカバレッジがあることを完了条件とします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100