Subplot panel height not consistent
Nessuno ha ancora preso questa issue.
- Lingua principale
- R
- Stelle
- 2.7k
- Fork
- 641
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
There doesn't seem to be a way to set the total figure size for subplot().
Individual panel height can be specified in the call to plot_ly and (as i understand it) that height is scaled with the number of panels to become the total figure size.
I tried using this by passing to each subplot the individual plotheight multiplied with the number of subplots (nrows) so the total height of the total figure would be plotheight * nrows.
It turns out the heights aren't strictly adhered too.
Comparing the total height of the first two panels you can clearly see the x axes are at different heights:

generate_subplot <- function(nrows, margin = NULL){
if(is.null(margin)) margin = c(0,0,0,0)
p <- plotly::plot_ly(mtcars,
x = ~cyl, y = ~mpg,
color = ~rownames(.data),
type = "bar",
height = 150 * nrows
) %>% plotly::layout(
showlegend = FALSE,
shapes = list(
list(
type = 'rect',
fillcolor = "gray",
line = list(color = "gray"),
opacity = 0.05,
x0 = 0, x1 = 1,
y0 = 0, y1 = 1,
xref = 'paper',
yref = 'paper'
)
)
)
plotly::subplot(
rep_len(list(p), nrows),
nrows = nrows,
margin = margin
)
}
generate_subplot(2)
generate_subplot(4)
generate_subplot(8)
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia eseguendo l'esempio fornito di generate_subplot per 2, 4 e 8 righe e confronta le altezze dei pannelli e degli assi x nelle figure renderizzate. Traccia il modo in cui subplot() combina gli oggetti plot_ly ripetuti e i relativi valori di altezza; il lavoro è completo quando ogni pannello ha l'altezza uniforme richiesta e l'altezza totale della figura scala come previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- r
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100