Cannot change colour legend position for continuous variable
オープン
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Locked question #1049 relates to the same issue, which still persists. Changing legend position is fiddly but works ok for factor variable:
require(ggplot2)
require(ggmap)
require(plotly)
m = c(left=60.5, bottom =29.3, right = 75.2, top = 38.5) |>
ggmap::get_stamenmap(maptype = 'toner', zoom = 6)
d = data.frame(x = rnorm(mean = 65, sd = 3, 50),
y = rnorm(mean = 34, sd = 2, 50))
p1 = ggmap(m) +
geom_point(data=d, aes(x, y, col = factor(round(x))), size=3) +
labs(col = 'Eastness', x = NULL, y = NULL) +
theme_void()
ggplotly(p1) |> layout(legend = list(xanchor = "left", x = 0, yanchor = "bottom", y = 0.2))
But for a continuous variable this fails:
p2 = ggmap(m) +
geom_point(data=d, aes(x, y, col = x), size=3) +
labs(col = 'Eastness', x = NULL, y = NULL) +
theme_void()
ggplotly(p2) |> layout(legend = list(xanchor = "left", x = 0, yanchor = "bottom", y = 0.2))
This seems to me this is a pretty basic and important thing to get right. I wonder if there's any chance to fix?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue にある p1 と p2 の再現可能な R の例を実行し、layout の呼び出し後に factor のカラー凡例と連続カラー凡例を比較します。ggplotly が各凡例をどのように変換し、layout の位置指定がどのように適用されるかを追跡します。連続カラー凡例が要求された位置に移動し、factor のケースを壊さなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100