plotly / plotly/plotly.R

Unexpected behavior with geom_rect and ids arg in ggplotly()

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

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

difficulty: high ggplotly priority: low
主要言語
R
スター
2.7k
フォーク
641
PR マージ指標
30日以内にマージされた PR はありません

説明

Expected behavior demonstrated by geom_point. See ggplotly(gg1) below.

Unexpected behavior when using geom_rect with the ids arg across frames with changing number of observations. See ggplotly(gg2) and ggplotly(gg3) below.

### Win 10 x64, Rstudio
library(ggplot2) # ggplot2_3.0.0 
library(plotly)  # plotly_4.7.1
data(gapminder, package = "gapminder")

# filtering out some countries (soframes have differing number of obs)
sub_countries <- unique(gapminder$country)[1:10]
gapminder2 <- gapminder %>% 
  filter(((year != 1952) | (country %in% sub_countries)) & year < 1970)

# using geom_point (works)
gg1 <- ggplot(gapminder2) +
  geom_point(aes(x = gdpPercap, y = lifeExp, 
                 ids = country,
                 frame = year)) +
  scale_x_log10()
ggplotly(gg1) # correct: sub, full, full, full

# using geom_rect (doesn't work with ids arg)
gg2 <- ggplot(gapminder2) +
  geom_rect(aes(xmin = gdpPercap, ymin = lifeExp, 
                xmax = 1.05 * gdpPercap, ymax = 1.05 * lifeExp, 
                ids = country,
                frame = year))  +
  scale_x_log10()
ggplotly(gg2) # incorrect: sub, sub, sub, sub

# using geom_rect, subset on 2nd frame (doesn't work with ids arg)
gapminder3 <- gapminder %>% 
  filter(((year != 1957) | (country %in% sub_countries)) & year < 1970)

gg3 <- ggplot(gapminder3) +
  geom_rect(aes(xmin = gdpPercap, ymin = lifeExp, 
                xmax = 1.05 * gdpPercap, ymax = 1.05 * lifeExp, 
                ids = country,
                frame = year))  +
  scale_x_log10()
ggplotly(gg3) # incorrect: full, sub moves, full, full
  # frame year 1952 -> 1957 != 1962 -> 1957 != 1967 -> 1957

Cheers,
Nick

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

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

はじめの一歩

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

調査の方向性

提供された R の再現コードを ggplot2 と plotly で実行し、観測数が変化するフレーム間で geom_point と geom_rect を比較します。geom_rect、ids、フレーム処理に関する ggplotly の変換経路を追跡します。geom_rect がすべてのフレームで正しい観測値と ids を保持し、示されている期待される動作と一致すれば完了です。

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

評価

技術スタック
r
領域
data-visualization
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

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

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