plotly / plotly/plotly.js

Add an option to set the opacity of markers in the legend

Open
#7,208 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
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;
}

👇 CodePen for Testing

image

Related posts:

Thank you for maintaining one of the best DataViz libraries! 👍

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.