plotly / plotly/plotly.R

ggplotly ignores scale_y_discrete(breaks = NULL)

Offen
#1,154 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

ggplotly
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:

ggplot_2

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

ggplotly_2

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

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Ö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

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.