ggplotly() is unable to merge legend entries across layers
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Thanks for an amazing package! The mapping between plotly and ggplot is particularly impressive and very powerful!
However, ggplotly fails to reproduce the appropriate legends generated by ggplot in non-trivial facet_wrap cases. After discussion on stackoverflow some of this behavior appears to be a bug.
Consider the following minimal reprex:
library(plotly)
library(ggplot2)
p <- mpg %>%
ggplot(aes(year)) +
geom_ribbon(aes(ymin=cty, ymax=hwy, fill = manufacturer), alpha=0.2) +
geom_line(aes(y = hwy, col=manufacturer)) +
facet_wrap(~class)
p
plotly::ggplotly(p)
Note that (a) we get too many plotly legend entries, duplicating the legend for each facet, due to legendgroup not being correctly handled. Also note (b) the legends we do and don't get depend on the order (do we do geom_ribbon first or geom_line first). The bug does not appear if we have only one geom, and the missing legends continue as we add more geoms.
Perhaps not related -- but the interactive zoom options in faceted plots are not entirely intuitive either, i.e. it's not possible to zoom the whole window on a single facet plot. (Perhaps the take home is that it might be better to render facet plots as more independent objects in plotly)?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
geom_ribbon、geom_line、facet_wrap(~class)を使用した最小限のggplotly() reprexから始め、その後、レイヤーとファセット間でlegendgroupがどのように扱われているかを調べます。変換後の凡例をggplot2で期待される凡例と比較します。geomの順序に関係なく重複または欠落した項目がなく、ファセットの動作が維持されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100