Skip to content

ggplotly with facet_grid creates copies of legend items #438

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
royr2 opened this issue Jan 28, 2016 · 2 comments
Closed

ggplotly with facet_grid creates copies of legend items #438

royr2 opened this issue Jan 28, 2016 · 2 comments

Comments

@royr2
Copy link

royr2 commented Jan 28, 2016

Hi @cpsievert
Is there any way to let each trace remain associated with the same legend item (as opposed to having a new legend item for each plot)? Just the way ggplot2 does it?

thanks !

library(plotly)
library(reshape2)

ds <- data.frame(X = 1:100, 
                 Y1 = rnorm(100), 
                 Y2 = rnorm(100), 
                 group = LETTERS[1:4])

ds <- melt(ds, id = c("X", "group"))

ggplot(ds, aes(X, value)) + 
  geom_point(aes(color = group)) +
  facet_wrap(~variable)
ggplotly()

ggplot:
image

ggplotly:
image

@cpsievert
Copy link
Collaborator

Duplicate of #378.

@royr2
Copy link
Author

royr2 commented Jan 28, 2016

Okay, thanks...

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

2 participants