`guide_legend(reverse = TRUE)` does not reverse legend order
オープン
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I reversed the legend order with guide_legend(reverse = TRUE), but the legend is unchanged in the plotly plot. The ggplot version is reversed.
library(plotly, warn=FALSE)
#> Loading required package: ggplot2
set.seed(123)
df <- data.frame(x = rnorm(10), y = rnorm(10), group = rep(c("A", "B"), times = 5))
p1 <- ggplot(df, aes(x = x, y = y, color = group)) +
geom_line() +
guides(color = guide_legend())
# Legend order default
# Plot with guides
p2 <- ggplot(df, aes(x = x, y = y, color = group)) +
geom_line() +
guides(color = guide_legend(reverse = TRUE))
# Legend order reversed
# Convert ggplot with reversed legend order
ggplotly(p2)
# Legend not reversed
Originally posted by @simonsteiger in https://github.com/plotly/plotly.R/issues/2234#issuecomment-1457010264
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された R の例を実行し、ggplot の凡例と ggplotly(p2) の結果を比較します。次に、guide_legend(reverse = TRUE) に対する ggplotly の変換経路を追跡し、変換後のプロットで凡例の逆順が維持されていることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100