plotly / plotly/plotly.R

Redundant legend entries in facetted animations

Open
#926 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

MRE of a problem pointed out in #919

p <- ggplot(mtcars, aes(mpg, wt, color = factor(am))) +
  # works fine without frame
  #geom_point() + 
  geom_point(aes(frame = factor(vs))) +
  facet_wrap(~cyl)

ggplotly(p)

This also seems to be a problem for the non-ggplot2 approach:

library(dplyr)
mtcars %>%
  group_by(cyl) %>%
  do(
    p = plot_ly(., x = ~mpg, y = ~wt, color = ~factor(am), legendgroup = ~factor(am), frame = ~factor(vs))
  ) %>%
  subplot()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied ggplotly and non-ggplot2 MREs to reproduce the duplicate legend entries in facetted animations. Trace the legend handling for facets, colors, legendgroup, and frames, then verify that both examples produce non-redundant legends without breaking their animation or subplot behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.