plotly / plotly/plotly.R

When calling on geom_area tooltip activates when hovering over line, not area

Offen
#2,343 0 Kommentare 0 Reaktionen 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

Calling ggplotly on ggplot invoking geom_area results in a plot in which the tooltip activates when hovering over the "lines" separating the areas. I would have expected the tooltip to activate when hovered over the filled area.

Here is some reprex

library("ggplot2")
library("plotly")

#create the data
data <- data.frame('year' = rep(1981:2020, 2),
           "type" = rep(c("a", "b"), 40),
           "value" = runif(80))

#Generate the plot
ggplotly(
  ggplot(data, 
         aes(x = year, y = value, fill = type)) +
    geom_area(col = "grey", size = 0.5) #set the line col so that you can see the activation when close to the line
)
  

I don't see any open or closed issues on this. Online, I only see this solution: https://stackoverflow.com/questions/47331323/ggplotly-and-geom-area-display-informations-when-hovering-over-an-area-not-a, which seems convoluted.

Regardless of that solution, I would still assume the expected behavior for geom_area is for the tooltip to activate over the area, not the line.

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 bereitgestellte reprex mit R, ggplot2 und plotly auszuführen, und untersuche anschließend die ggplotly-Konvertierung im Hinblick auf das Hover-Verhalten von geom_area. Als erledigt gilt die Aufgabe, wenn der Tooltip beim Überfahren der ausgefüllten Fläche aktiviert wird und nicht nur entlang der Linien, die die Flächen voneinander trennen.

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.