Bug: ggplotly ignores colours in ggplot2::scale_fill_gradientn when limits are below the range of the data
オープン
まだ誰も着手していません。
bug
ggplotly
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
This is an odd bug (reported first as a heatmaply issue).
If we create a ggplot2 object with colors based on scale_fill_gradientn, then ggplotly respect the colors. But if the limits are set to be within (instead of outside) the range of the data, then ggplotly stops respecting the colors. This may be some fallback for how to deal with NA colors (but I don't know enough about ggplotly to know for sure).
Here is a self contained example:
library(ggplot2)
library(viridis)
library(plotly)
# Equivalent fill scales do the same job for the fill aesthetic
p <- ggplot(faithfuld, aes(waiting, eruptions)) +
geom_raster(aes(fill = density)) +
scale_fill_gradientn(colours = viridis(10), limits = c(0.001,.01))
p
ggplotly(p)
Plot in ggplot2:

Plot in plotly (see the wrong colors produced!)

コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、ggplot2、viridis、plotly を使用した自己完結型の R の例を実行し、scale_fill_gradientn の範囲がデータ範囲を下回る場合の ggplot2 と ggplotly の色の出力を比較します。このケースで ggplotly が意図したグラデーションの色を維持すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100