Skip to content

ggplotly with facet_grid creates copies of legend items #438

Closed
@royr2

Description

@royr2

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions