Annotations for factor in barplot misplaced
オープン
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
When adding annotations to a barplot with x as factor, the plot gets squished
Problem arises since R plotly version 4.10.1. Worked fine until plotly 4.9.2.1
This works not
plotData <- data.frame(x = factor(1991:2000), y = rnorm(10))
plot_ly(data = plotData, x = ~x, y = ~y, type = "bar") %>%
layout(annotations = list(x = plotData$x, y = 0, text = 1:10))

This works, although it is safer to match on the actual x-values (factor levels) rather than on a numeric variant (mind the -1 to get it start at 0!)
plotData <- data.frame(x = factor(1991:2000), y = rnorm(10))
plot_ly(data = plotData, x = ~x, y = ~y, type = "bar") %>%
layout(annotations = list(x = as.numeric(plotData$x) - 1, y = 0, text = 1:10))

コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
factor 型の x 値を使用する、提供された plot_ly() と layout(annotations = ...) の再現から始め、plotly.R 4.9.2.1 と 4.10.1 の間で動作を比較します。factor アノテーションがどのように変換されるかを追跡し、数値の factor 値を必要とせずにアノテーションが棒のカテゴリと揃ったままになることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100