plotly::subplot with >= 3 rows/cols results in different sized plots for inner/boundary plots
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
As per title, when making a subplot with >= 3 rows or columns with a margin (default is 0.02 but the issue is easier to see with more plots/bigger margins)
library(magrittr)
p <- plotly::plot_ly(mtcars, x = ~cyl, y = ~mpg, color = ~rownames(.data), type = "bar") %>% plotly::layout(showlegend = FALSE)
plotly::subplot(p, p, p, p, p, p, p, p, p, nrows = 3, margin = 0.1)

There is a PR (#622) which aims to fix it, but the PR also does some extra things like make the margins fixed rather than scaled. I think it's possible to provide a much quicker & simpler fix as an alternative, given that this has been known about since 2016.
I think in a nutshell its due to the function get_domains & it's for loops:
https://github.com/plotly/plotly.R/blob/4bb1e44c5e27898bdf7ac45422564fa5200fb5f5/R/subplots.R#L385-L401
It's those if's that are the problem, can they be removed without causing too much trouble?
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 da R/subplots.R, in particolare da get_domains e dai cicli intorno alle righe 385–401. Esegui l'esempio R fornito con nrows = 3 e margin = 0.1, quindi confronta il dimensionamento dei domini per i grafici interni e quelli di bordo. Il lavoro è completato quando i pannelli di subplot hanno dimensioni coerenti; esamina PR #622 per il lavoro correlato prima di procedere.
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