plotly / plotly/plotly.R

subplot does not seem to handle well relatively long lists

Aperta
#1,515 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

plotly.js
Lingua principale
R
Stelle
2.7k
Fork
641
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi,

I'm trying to use subplot in order to vertically group bar plots, sharing their x-axis.

Here are example data which have 28 groups where I'm creating a bar plot over 4 families in each and then trying to vertically combine them using subplot:

set.seed(1)
df <- data.frame(group = paste0("G",unlist(lapply(1:28,function(i) rep(i,4)))),
                 family = paste0("F",rep(1:4,28)),
                 log2n = log2(as.integer(runif(4*28,0,30))+1),
                 stringsAsFactors = F)

Creating the list of bar plots:

library(plotly)
groups <- unique(df$group)
y.range <- c(0,max(df$log2n))
plot.list <- lapply(1:length(groups),function(g){
  group.df <- dplyr::filter(df,group == groups[g])
  plot_ly(x=group.df$family,y=group.df$log2n,type='bar',name=group.df$family,color=group.df$family,showlegend=(g==length(groups))) %>%
    layout(yaxis=list(range=y.range))
})

If I try:
p <- plotly::subplot(plot.list,shareX=T,nrows=length(plot.list))

Screen Shot 2019-04-10 at 6 48 53 PM

So it seems like some sort of an overflow.

I gradually cut down on the number of plots in plot.list that I run subplot on and when reach 19 it seemed to stop 'overflowing':
p <- plotly::subplot(plot.list[1:19],shareX=T,nrows=19)
Screen Shot 2019-04-10 at 6 50 37 PM

Any idea if there's hope to get all 28 bar plots without overflowing?

Thanks a lot

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la chiamata riproducibile a plotly::subplot usando 28 grafici a barre impilati verticalmente, quindi confrontala con il caso a 19 grafici che non va in overflow. Analizza come subplot gestisce nrows e gli assi x condivisi per liste lunghe di grafici; il lavoro è completato quando tutti i 28 grafici vengono renderizzati senza overflow, mantenendo l’asse e la legenda condivisi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
r
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.