feat(scatter): add color column and category customization support#497
Merged
palewire merged 6 commits intochekos:mainfrom Oct 30, 2025
Merged
feat(scatter): add color column and category customization support#497palewire merged 6 commits intochekos:mainfrom
palewire merged 6 commits intochekos:mainfrom
Conversation
Add documentation references for MultipleColumnXRangeAnnotation, MultipleColumnYRangeAnnotation, MultipleColumnXLineAnnotation, and MultipleColumnYLineAnnotation classes. Also adds section headers for existing MultipleColumnChart, MultipleColumnTextAnnotation, and MultipleColumnRangeAnnotation references to improve documentation structure and discoverability.
Updated the embedded Datawrapper chart ID from j4JDS to VVR4V in the stacked bar chart documentation example. Also clarified the stack_percentages parameter comment to better describe its purpose as "Enable percentage stacking" rather than "Display values as percentages" to avoid confusion with the separate value_label_format parameter.
Add support for coloring scatter plot points by column values with customizable category colors, labels, and ordering. This includes: - New `color_column` field to specify which column determines point colors - `color_category` mapping for custom category colors - `category_labels` for custom legend display names - `category_order` to control category appearance order - `exclude_from_color_key` to hide specific categories from legend - Serialization/deserialization logic using ColorCategory utility - Updated documentation with new color customization examples This enhancement allows users to create more informative scatter plots by encoding an additional dimension through color while maintaining full control over the visual presentation.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances scatter plot functionality by adding color categorization support, updates documentation examples with corrected data and improved styling, and improves documentation organization for multiple column charts.
- Added
color_column,color_category,category_labels,category_order, andexclude_from_color_keyfields to theScatterPlotclass - Updated scatter plot documentation example with color categories, revised text annotations using
dw.TextAnnotationobjects, and extensive custom line configurations - Updated stacked bar chart documentation comment for clarity
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| datawrapper/charts/scatter.py | Adds color categorization fields and serialization/deserialization logic for scatter plots |
| docs/user-guide/charts/scatter-plots.md | Updates scatter plot example with color categories, custom lines, revised tooltip HTML, and structured text annotations; adds missing closing code fence |
| docs/user-guide/charts/stacked-bar-charts.md | Updates iframe embed ID and clarifies comment about percentage stacking |
| docs/user-guide/charts/multiple-column-charts.md | Adds section headers for better organization of reference documentation |
Comments suppressed due to low confidence (1)
docs/user-guide/charts/scatter-plots.md:342
- Missing closing code fence was added, fixing the documentation formatting issue.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ists
Previously, color_column was always set using axes.get("color"), which would
assign None when the color key didn't exist. This change only sets color_column
in init_data when a color axis is explicitly defined, preventing unnecessary
None assignments and improving data structure clarity.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
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.
Add support for coloring scatter plot points by column values with customizable category colors, labels, and ordering. This includes:
color_columnfield to specify which column determines point colorscolor_categorymapping for custom category colorscategory_labelsfor custom legend display namescategory_orderto control category appearance orderexclude_from_color_keyto hide specific categories from legendThis enhancement allows users to create more informative scatter plots by encoding an additional dimension through color while maintaining full control over the visual presentation.