legendrank (bar chart example)
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- plotly, r
調査の方向性
提供された R reprex を実行し、plotly_json(px) を調べて、bar trace に対する legendrank のマッピングがどのように表現されているかに注目します。生成された凡例の順序を要求された rank と比較します。完了とは、trace が rank 順に表示されるか、issue が説明され、適切な regression test でカバーされていることを意味します。
索引モデルが issue の本文から書いたものです。
説明
This bug report concerns R plotly 4.10.1.
I was going to file a report regarding a more complex composite chart; involving bars and lines; as I noticed when there was an NA(or NaN) value to plot against the Y axis , the legend orders got scrambled. I was able to directly address this shortcoming in my own code by na.omit() on my input dataset. However , in the course of trying to simplify my code down to be more minimal for this reprex, I encountered a more basic issue of the legendrank seemingly not being respected
library(tidyverse)
library(plotly)
(tot_df <- structure(list(
rank = structure(c(
1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L
), levels = c(
"1", "2", "3",
"4"
), class = "factor"), value = c(
1, 0.316227766016838, 2, 0.447213595499958,
3, 0.547722557505166, 4, 0.632455532033676, 5, 0.707106781186548,
3, 0.547722557505166, 2, 0.447213595499958, 1, 0.316227766016838
), name = c(
"stat1", "stat_2", "stat1", "stat_2", "stat1", "stat_2",
"stat1", "stat_2", "stat1", "stat_2", "stat1", "stat_2", "stat1",
"stat_2", "stat1", "stat_2"
), `Display name` = structure(c(
1L,
1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L
), levels = c(
"Reference",
"Current"
), class = "factor"), series_name_text = structure(c(
1L,
2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L
), levels = c(
"Reference stat1",
"Reference stat_2", "Current stat1", "Current stat_2"
), class = "factor"),
my_legend_rank = c(
1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L,
3L, 4L, 1L, 2L, 3L, 4L
)
), row.names = c(NA, -16L), class = c(
"tbl_df",
"tbl", "data.frame"
))
)
px <- plot_ly(
data = tot_df,
width = 800,
height = 600,
x = ~rank,
y = ~value,
name = ~series_name_text,
legendrank = ~my_legend_rank,
color = ~`Display name`,
colors = c("green", "blue"),
textposition = "none",
type = "bar",
opacity = .5,
yaxis = "y"
) |> layout(legend = list(
orientation = "h",
xanchor = "center",
yanchor = "bottom",
y = -0.3,
x = 0.5
))
# table(tot_df$series_name_text,tot_df$my_legend_rank
# 1 2 3 4
# Reference stat1 4 0 0 0
# Reference stat_2 0 4 0 0
# Current stat1 0 0 4 0
# Current stat_2 0 0 0 4
plotly_json(px)

It seems to me that based on legendrank 'Reference stat1 should be the first i.e. leftmost trace name observed within the legend box, and this isnt the case, the first seen is Current stat1, that should be in 3rd position...)
Is there a gotcha here ? some incorrect setup ? something that invalidates the use of legendrank ?
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
plotly/plotly.R のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
-
save_image Error オープン
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
plotly/plotly.R の issue をすべて見る
似ている issue
-
documentation pkg infrastructure
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
epiverse-trace/epiparameter#511 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
pharmaverse/aNCA#1496 ·
-
function:write_dwc
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
Urgent request: Due to vulnerabilities move to API version 12.6.1 (12.6.2 eventually) or 13.1.1 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
jbkunst/highcharter#849 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
r-lib/pkgdepends#485 · コメント 4 件 ·