pies and subplot not working as expected
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Based on this StackOverflow post, it seems pie charts are not working as I would expect with subplot. I will admit though that this is my first ever attempt at pie charts in Plotly. I did verify by inspecting DOM that both pies do exist in the examples below.
# devtools::install_github('ropensci/plotly")
library(plotly)
ds_r <- data.frame(labels1 = c("Baseline", "DTC", "Detailing", "Flex"),
values1 = c(63.5, 8.5, 20.6, 7.4))
ds_l <- data.frame(labels2 = c("Baseline"),
values2 = c(100))
p <- plot_ly(
ds_r, labels = ~labels1, values = ~values1, type = "pie",
showlegend = F
)
p2 <- plot_ly(
ds_l,labels = ~labels2, values = ~values2, type = "pie",
showlegend = F
)
subplot(p, p2, nrows = 1)

empty axes
# devtools::install_github('ropensci/plotly")
# an "empty" plotlyjs axis for layout
emptyAxis <- list(
title = "",
zeroline = FALSE,
showline = FALSE,
showticklabels = FALSE,
showgrid = FALSE
)
p <- plot_ly(
ds_r, labels = ~labels1, values = ~values1, type = "pie",
showlegend = F
) %>% layout(xaxis = emptyAxis, yaxis = emptyAxis)
p2 <- plot_ly(
ds_l,labels = ~labels2, values = ~values2, type = "pie",
showlegend = F
) %>% layout(xaxis = emptyAxis, yaxis = emptyAxis)
subplot(p, p2, nrows = 1)

Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die beiden reproduzierbaren Beispiele mit und ohne das Layout mit leeren Achsen unter Verwendung von plot_ly() und subplot() auszuführen. Verfolge, wie subplot() pie-Traces und Achsen zuweist; abgeschlossen ist die Aufgabe, wenn beide Kreisdiagramme nebeneinander korrekt gerendert werden, ohne leere Achsen zu benötigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100