`ggplotly` uses colour that doesn't match the displayed gradient when providing one single numeric value to `fill` or `colour`
オープン
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
When converting from a ggplot object to a plotly interactive visualisation with ggplotly(), if there is only one numeric value for fill or colour, the wrong gradient colour is used according to the displayed legend. The legend uses a white-to-red gradient that doesn't match the blue gradient used in ggplot2.
library(ggplot2)
library(plotly)
# fill takes one numeric value
(single_value <- ggplot(mapping = aes(x = 1, y = 1, fill = 1)) +
geom_col())

Convert to plotly:
# ggplotly(single_value)

Using two numeric values works well:
# fill takes 2 numeric values
(two_values <- ggplot(mapping = aes(x = 1:2, y = 1:2, fill = 1:2)) +
geom_col())

Convert to plotly:
# ggplotly(two_values)

Using:
- R 4.1.0
- ggplot2 3.3.3
- plotly 4.9.3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue にある単一値と 2 値の例を実行し、ggplot2 と ggplotly の出力を比較します。fill または colour のグラデーションと凡例に注目してください。単一の数値によって、表示された凡例と一致するレンダリング済みのグラデーション色が生成され、fill と colour の両方を対象とするリグレッションテストがあることが、issue の完了条件です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100