Skip to content

ggplotly()'s colorbar trace can override hover behavior #1381

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

Closed
cpsievert opened this issue Oct 31, 2018 · 0 comments
Closed

ggplotly()'s colorbar trace can override hover behavior #1381

cpsievert opened this issue Oct 31, 2018 · 0 comments

Comments

@cpsievert
Copy link
Collaborator

cpsievert commented Oct 31, 2018

Thanks to @goodekat for the reprex

library(plotly)
library(tidyr)

m <- matrix(rnorm(9), nrow = 3, ncol = 3)

m_gathered <- data.frame(m) %>%
  gather(key = column) %>%
  mutate(row = factor(rep(c("X1", "X2", "X3"), 3))) %>%
  select(column, row, value)

p <- ggplot(m_gathered, aes(x = column, y = row, fill = value)) +
  geom_tile()

# Apply plotly to ggplot heatmap - deadspace in the middle of (X1, X1)
ggplotly(p)

hover

The fix seems easy -- change hoverinfo="none" to hoverinfo="skip" when creating the colorbar trace

https://github.com/ropensci/plotly/blob/7031a25474f0dc275d20897810682c530cd1fbf3/R/ggplotly.R#L1303

cpsievert added a commit that referenced this issue Nov 1, 2018
use hoverinfo skip instead of none for invisible ggplotly() colorbar trace, closes #1381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant