plotly / plotly/plotly.R

Missing colors in heatmap if values are the identical

Offen
#1,926 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Hello!
when creating a heatmap where values are all the same on a continuous scale, I get the expected colors from ggplot. However, when I put my ggplot into ggplotly, the colors are gone and it's all gray. Only happends, when values are identical. Happens with version 4.9.3 of plotly.

library(ggplot2)
library(dplyr)
library(plotly)

data <- tibble(hour = c(1, 1, 2, 2), day = c(1, 2, 1, 2), evaluation = c(1, 1, 1, 1))
g <- ggplot(data = data, mapping = aes(x = hour, y = day))
g <- g + geom_tile(aes(fill = evaluation), color = "white")
g <- g + scale_fill_gradientn(limits = c(0, 1), colours = c("red", "green"), name = "Availability")

print(g)         # ok, all colors are green as expected
print(ggplotly(g)) # not ok, colors in heatmap are gray, expected to be green

Please let me know if you need more explanation or additional information to track this down.

Thank you and kind regards,
Heiko

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 mit dem reproduzierbaren R-Beispiel im Issue und verfolge die ggplotly-Konvertierung für eine kontinuierliche Heatmap, deren Bewertungswerte identisch sind. Vergleiche die Ausgaben von ggplot und ggplotly und überprüfe anschließend, dass die konvertierten Kacheln die erwartete grüne Farbe statt Grau verwenden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, r
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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