plotly / plotly/plotly.R

geom_tile with only one possible value is grey

Offen
#907 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug ggplotly
Vorherrschende Sprache
R
Sterne
2.7k
Forks
641
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

There seems to be a problem when a fill value in geom_tile only has one possible value.
Example below. You get grey instead of the color ggplot2 uses. This is an issue when you facet a geom_tile and one facet only contains one possible value. Then you get a completely grey tile instead of what color the value should have.

I'm guessing this has to do with scaling? Since you get NaN if you scale only identical values.

pp <- function (n,r=4) {
 x <- seq(-r*pi, r*pi, len=n)
 df <- expand.grid(x=x, y=x)
 df$r <- sqrt(df$x^2 + df$y^2)
  # df$z <- 1
  df$z <- c(1,2)
 df
}


p <- ggplot(pp(20), aes(x=x,y=y))
p <- p + geom_tile(aes(fill=z))

p
ggplotly(p)

ggplot:
image

plotly:
image

pp <- function (n,r=4) {
 x <- seq(-r*pi, r*pi, len=n)
 df <- expand.grid(x=x, y=x)
 df$r <- sqrt(df$x^2 + df$y^2)
   df$z <- 1
  # df$z <- c(1,2)
 df
}


p <- ggplot(pp(20), aes(x=x,y=y))
p <- p + geom_tile(aes(fill=z))

p
ggplotly(p)

ggplot:
image

plotly:
image

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, die beiden bereitgestellten R-Beispiele auszuführen und die ggplot- und ggplotly-Ausgabe zu vergleichen, einschließlich der Fälle mit einem einzelnen Wert und mit Facetten. Verfolge, wie ggplotly die geom_tile-Farbskala behandelt; abgeschlossen ist die Aufgabe, wenn ein einzelner möglicher Farbwert in seiner vorgesehenen Farbe statt in Grau dargestellt wird.

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
38/100

Neue Issues direkt in Ihr Postfach

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