Add an option to set the opacity of markers in the legend
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
Can you kindly consider adding an option to set the opacity of legend markers? Currently, the opacities of the legend's markers are tied to the opacity values of the traces.
Plotly Version
plotly.js v2.35.2
Some scatter plots use a very low opacity (<0.10) to display the concentration of overlapping data points.
👇 This can result in imperceptible marker colors in the legend, as shown below:
👇 Feature request: add an option to set the legend marker opacity
I used a workaround to manually set the opacity of the scatterpts class using CSS.
/* current workaround */
.legendpoints .scatterpts {
opacity: 1 !important;
}
Related posts:
- Issue: px.scatter_geo opacity changes markers opacity and legend items opacity. Is there a way to change one but not the other?
- Legend marker opacity and spacing
- Configuring the alpha (opacity, transparency) for the items in legend of scatter plot of plotly
Thank you for maintaining one of the best DataViz libraries! 👍
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
Use the linked CodePen to reproduce the low-opacity scatter-plot legend markers in plotly.js and inspect the legend marker behavior behind the .legendpoints .scatterpts workaround. Define an option whose value controls legend marker opacity independently of trace opacity, then verify that both the legend appearance and trace rendering remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100