Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
Rhoahndur wants to merge2 commits intoplotly:masterChoose a base branch fromRhoahndur:feature/add-attribute-legends
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+4,590 −13
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 Issueplotly#5099 adds three new legend components that showunique values from marker attributes (color, size, symbol) ratherthan trace-based legends.New components:- colorlegend: displays unique color values as swatches- sizelegend: displays size ranges as graduated circles- symbollegend: displays unique marker symbolsFeatures:- 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
64a2bf4 to74a792aCompare74a792a to8c270e0CompareAuthor
Rhoahndur commentedNov 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 freeto 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