-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Add attribute-based legends (colorlegend, sizelegend, symbollegend) #7656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implementation for Issue plotly#5099 adds three new legend components that show unique values from marker attributes (color, size, symbol) rather than trace-based legends. New components: - colorlegend: displays unique color values as swatches - sizelegend: displays size ranges as graduated circles - symbollegend: displays unique marker symbols Features: - Click to toggle visibility of points with that attribute value - Support for multiple legends (colorlegend, colorlegend2, etc.) - Configurable positioning, styling, and orientation - Works with scatter and scatter-variant traces
@Rhoahndur
Rhoahndur
force-pushed
the
feature/add-attribute-legends
branch
from
November 27, 2025 01:38
64a2bf4 to
74a792a
Compare
@Rhoahndur
Rhoahndur
force-pushed
the
feature/add-attribute-legends
branch
from
November 27, 2025 02:06
74a792a to
8c270e0
Compare
Author
Rhoahndur
commented
Nov 27, 2025
The failing image tests (uniformtext_sunburst_treemap, treemap_textfit, treemap_sunburst_marker_colors, treemap_packages_colorscale_novalue, sunburst_coffee) are unrelated to my changes - I did not modify any sunburst or treemap code. These appear to be pre-existing issues or environment-specific failures.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Implementation for Issue #5099 ( #5099 ) adds three new legend components that show unique values from marker attributes (color, size, symbol) rather than trace-based legends.
New components:
Features:
Summary
This PR implements attribute-based legends as requested in #5099.
Currently, Plotly.js legends are trace-centric (one entry per trace), which becomes unwieldy when multiple traces share visual attributes like color scales or size mappings across hundreds of points. This enhancement adds three new legend components that allow users to create separate legends based on marker attributes:
colorlegend- Discrete color swatch legend for categorical or binned color valuessizelegend- Graduated circle legend for size rangessymbollegend- Symbol shape legend for marker symbolsNew Trace Attributes
marker.colorlegend- Reference tolayout.colorlegendmarker.sizelegend- Reference tolayout.sizelegendmarker.symbollegend- Reference tolayout.symbollegendExample Usage