layout.shapes.legendgroup is unexpectedly non-functional
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
layout.shapes.legendgroup is non-functional although included in the official reference (https://plotly.com/r/reference/layout/shapes/)
In the below reprex, I have set all objects to the same legendgroup. I would expect them all to disappear when clicking on the legend but this does not happen.
library(plotly)
x <- seq(-2 * pi, 2 * pi, length.out = 1000)
df <- data.frame(x, y1 = sin(x), y2 = cos(x))
fig <-
plot_ly(df, x = ~x) %>%
add_lines(y = ~y1, name = "A", legendgroup = "B") %>%
add_lines(y = ~y2, name = "B", legendgroup = "B")
fig %>%
plotly::layout(shapes =
list(
list(type = "rect",
fillcolor = "blue", line = list(color = "blue"), opacity = 0.3,
x0 = -1, x1 = 1, xref = "x",
y0 = -0.5, y1 = 0.5, yref = "y", legendgroup = "B")))
Example adapted from https://plotly.com/r/dropdowns/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided R reprex and compare the shape's legendgroup behavior with the two line traces. Use the layout.shapes reference as the expected behavior; done means clicking the shared legend entry hides and shows the shape together with the grouped traces.
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