Categoryorder not working when specifying plot type
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
When using the category order parameter, no plot is generated if the plot type is specified in the plot_ly call:
p <- plotly::plot_ly(type = 'bar')
colNames <- names(iris)
colNames <- colNames[-which(colNames == 'Species')]
for(trace in colNames){
p <- p %>% plotly::add_trace(data= iris, x = ~ Species, y = as.formula(paste0("~`", trace, "`")), name = trace)
}
p %>% layout(xaxis = list(categoryorder='total descending'))
With the following warning, which I don't understand since I'm not combining discrete and non-discrete data in the same axis:
Warning message:
Can't display both discrete & non-discrete data on same axis
If I specify the type in add_trace instead of the plot, then it works correctly and the warning is gone:
p <- plotly::plot_ly()
colNames <- names(df)
colNames <- colNames[-which(colNames == 'Species')]
for(trace in colNames){
p <- p %>% plotly::add_trace(type = 'bar', data= iris, x = ~ Species, y = as.formula(paste0("~`", trace, "`")), name = trace)
}
p %>% layout(xaxis = list(categoryorder='total descending'))
Maybe this is the intended behavior? If so, why does specifying the type in the traces works and not in the plot? The warning seems unclear to me.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された R reproduction を iris で実行し、plot_ly(type = 'bar') と add_trace(type = 'bar') を比較します。plot_ly と add_trace が type をどのように伝播するか、また layout(xaxis = list(categoryorder = 'total descending')) が結果として得られる traces をどのように処理するかを追跡します。完了条件は、reproduction が警告を出力しなくなり、category ordering が一貫して機能することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100