ggplotly ignores scale_y_discrete(breaks = NULL)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
In ggplot, scale_y_discrete(breaks = NULL) eliminates axis tick marks and grid lines for the specified discrete axis, like so:

But ggplotly() does not apply this setting, producing this output:

Note that scale_y_discrete(breaks = NULL) does have some impact, by causing the y axis title to overlap the y axis tick mark values, which does not happen if that line of code is omitted.
Reproducible example:
library(ggplot2)
library(dplyr)
library(plotly)
d = data.frame(case = as.factor(rep(1:5, each = 4)),
time = as.factor(rep(1:4, times = 5)))
p = d %>%
ggplot(aes(x = time, y = case)) +
geom_point() +
# suppress the y axis labels and grids (ggplotly ignores this):
scale_y_discrete(breaks = NULL)
print(p) # standard ggplot output has no y axis breaks
ggplotly(p) # but plotly output includes y axis breaks
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, das reproduzierbare R-Beispiel mit ggplot2 und plotly auszuführen, und vergleiche die standardmäßige ggplot-Ausgabe mit ggplotly(p). Verfolge, wie scale_y_discrete(breaks = NULL) von ggplotly übersetzt wird; abgeschlossen ist die Aufgabe, wenn der konvertierte Plot keine Markierungen, Beschriftungen oder Gitterlinien an der y-Achse aufweist und damit ggplot entspricht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- plotly, 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