plotly / plotly/plotly.R

Updatemenu buttons is not working properly, graph disappearing

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

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

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

説明

Hi,
I am trying to add buttons in plotly R by using updatemenus option to change xaxis range. I am using category array. I have 10 variable in x-axis as given below. When I use "7A" instead of "1234500" as variable at x-axis, updatemenus is working properly and it is changing graph with selected range. If I use "1234500" instead of "7A", graph is disappearing after changing range at menu. I could not find the reason.

I hope someone can help what is really wrong

Here is as an example code:

x<-c("1A","2A","3A","4A","5A","6A","1234500","1234501","1234502","1234503")
random_y <- sample(1:10, 10, replace=T)
random_z <- sample(1:10, 10, replace=T)
random_w <- sample(1:10, 10, replace=T)
data <- data.frame(x, random_y, random_z, random_w)

y<-ceiling(length(data$x)/3)
buttons<-vector(mode = "list", length = y)

for(i in 1:y){
  lower<-(i-1)*3
  upper<-i*3-1
    
 a<- list(
      label = as.character(i*3),
      method = "update",
      args = list(list(visible = c(T,T,T)), 
                  list(xaxis = list(range = c(lower, upper))))
      )
 buttons[[i]]<-a
}

updatemenus <- list(
  list(
    active = -1,
    type = 'dropdown',
    direction = "down",
    buttons = buttons
  )
)

fig <- plot_ly(data, x = ~x, y = ~random_y, type = 'bar') %>%
  add_trace(y = ~random_z)%>%
  add_trace(y = ~random_w)%>%
  layout(barmode = 'stack', xaxis = list(categoryorder = "array", categoryarray = ~x, range = c(0,10)),updatemenus = updatemenus
  )

fig

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

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

はじめの一歩

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

調査の方向性

plot_ly、add_trace、layout、および updatemenus の設定を使用して、提供された R の例を再現し、カテゴリ値 "7A" と "1234500" を比較します。xaxis の範囲の更新がカテゴリ軸にどのように適用されるかを追跡します。完了の条件は、ドロップダウンによって選択された範囲が変更され、グラフが消えないことです。

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

評価

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

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

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