plotly / plotly/plotly.R

Bug: ggplotly ignores colours in ggplot2::scale_fill_gradientn when limits are below the range of the data

オープン
#606 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

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:
image

Plot in plotly (see the wrong colors produced!)
image

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、ggplot2、viridis、plotly を使用した自己完結型の R の例を実行し、scale_fill_gradientn の範囲がデータ範囲を下回る場合の ggplot2 と ggplotly の色の出力を比較します。このケースで ggplotly が意図したグラデーションの色を維持すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
r
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。