Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
morrisseyj opened this issue Mar 6, 2024 · 0 comments

Comments

@morrisseyj
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant