geom_hline and geom_vline behave like a legend item when we apply filter
Open
Nobody has claimed this yet.
ggplotly
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
When we double click on a legend item to isolate it, the geom_hline and geom_vline lines are also hidden. They behave as legend items.
Related to Issue/696 ?
library("ggplot2")
library("plotly")
df = read.table(text =
"id year value1 value2 value3
1 2000 1 2000 2001
1 2001 2 NA NA
1 2002 2 2000 NA
1 2003 2 NA 2003
2 2000 1 2001 2003
2 2002 2 NA 2000
2 2003 3 2002 NA
3 2002 2 2001 NA
", sep = "", header = TRUE)
df$value1 <- as.factor(df$value1)
p <- ggplot(df, aes(y=id)) +
geom_point(aes(x=year, color=value1), size=4) +
geom_point(aes(x=value3, colour ='value3'), size=3) +
geom_point(aes(x=value2, colour ='value2'), size=5) +
geom_hline(yintercept=0) + geom_vline(xintercept=0) +
scale_colour_manual(name="",
values = c("1"="yellow", "2"="orange", "3"="red",
"value3"="grey", "value2"="black"))
ply <- ggplotly(p)
ply
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 supplied R reproduction with ggplot2, plotly, and ggplotly, then inspect how legend double-click isolation affects the geom_hline and geom_vline layers. Done means those reference lines remain visible when a legend item is isolated, while the plotted data still responds to the legend interaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100