Custom dimensions for a ggplot2 boxplot doesn't work with ggplotly
オープン
まだ誰も着手していません。
bug
ggplotly
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
When I create a ggplot2 boxplot with custom dimensions (see the bottom of http://ggplot2.tidyverse.org/reference/geom_boxplot.html#examples), plotly doesn't render the boxplot when I apply ggplotly. However, it works ok with a traditional boxplot where the dimensions are calculated by geom_boxplot/stat_boxplot.
Below is a reproducible example of the issue.
## Libraries
library(ggplot2)
library(plotly)
## Using fake data with extreme values
fake_data = data.frame(
y1 = c(rnorm(100, 2, 3), rnorm(10, 10, 15))
)
# ggplot2
g1 = ggplot(data=fake_data, aes(x ="cat1", y= y1)) +
#stat_boxplot(geom="errorbar") +
geom_boxplot() +
labs(title="Traditional Boxplot") +
ylim(c(-5, 25))
g1
quants = quantile(fake_data$y1, c(0.05, .25, .5, .75, .95))
q_df = data.frame(t(quants))
names(q_df) = c("y5", "y25", "y50", "y75", "y95")
g2 = ggplot(data=q_df, aes(x ="cat1")) +
#stat_boxplot(geom="errorbar") +
geom_boxplot(stat="identity", aes(,
ymin = y5, lower = y25,
middle = y50, upper = y75,
ymax = y95)) +
geom_point(data=subset(fake_data, (y1 > q_df$y95) | (y1 < q_df$y5)), aes(y=y1)) +
labs(title="5%/95% Boxplot") +
ylim(c(-5, 25))
g2
# plotly
plotly::ggplotly(g1)
plotly::ggplotly(g2) # DOESN'T WORK!
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue にある再現可能な R の例から始め、ggplotly(g1) と ggplotly(g2) を比較します。stat="identity" の箱ひげ図と、ymin、lower、middle、upper、ymax のカスタムマッピングに焦点を当ててください。失敗を再現し、その後、これらの箱ひげ図の値に対する ggplotly の変換経路を追跡します。カスタム次元のプロットが外れ値の点を保持したまま描画されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100