Multicategory axis support
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Hi,
I am trying to use multicategory axes and get very inconsistent behavior. This is what I tested so far:
Bar charts:
I need to manually supply type = "multicategory" to the axis. This is opposed to what I have read for the python api, where this will happen automatically if your traces have arrays. see here
reprex
library(plotly)
two_f <- rbind(
c("BB+", "BB+", "BB+", "BB", "BB", "BB"),
c(16, 17, 18, 16, 17, 18)
)
p <- plot_ly() %>%
add_bars(x=two_f,y=c(1,2,3,4,5,6)) %>%
layout(barmode="relative")
p # no multicategory axis
p_multi <- p %>% layout(xaxis=list(side = "top", type = "multicategory"))
p_multi # multicategory axis on top
Heatmaps:
Thanks to michaelbabyn, I know how to create a multicategory x-axis for a heatmap. However, as opposed to bar charts, making a multicategory y-axis crashes, and trying to move the x-axis on top of the chart also crashes.
reprex
library(plotly)
q <- plot_ly() %>%
add_heatmap(
x=rbind(c('aa', 'aa', 'bb', 'bb', 'cc', 'cc'), c(1,2,3,4,5,6)),
y=c(1,2,3,4,5,6),
z = array(seq(1,10, length.out = 36), c(6,6)))
q # this works
q_y <- plot_ly() %>%
add_heatmap(
x=c(1,2,3,4,5,6),
y=rbind(c('aa', 'aa', 'bb', 'bb', 'cc', 'cc'), c(1,2,3,4,5,6)),
z = array(seq(1,10, length.out = 36), c(6,6)))
## this would crash the Rstudio session:
## it should render something like https://codepen.io/michaelbabyn/pen/pMOOwM?editors=0010
# q_y
## this also breaks the session:
qx_top <- q %>% layout(xaxis=list(side = "top"))
# qx_top
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 bereitgestellten Reproduktionen von plot_ly(), add_bars(), add_heatmap() und layout() in RStudio auszuführen, und vergleiche dabei die Balken- und Heatmap-Fälle. Verfolge die Behandlung von Multikategorie-Achsen für x- und y-Achsen; abgeschlossen ist die Aufgabe, wenn die Beispiele konsistent gerendert werden, einschließlich der y-Achse der Heatmap und der oben positionierten x-Achse, ohne abzustürzen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100