Skip to content

feat(scatter): add color column and category customization support#497

Merged
palewire merged 6 commits intochekos:mainfrom
palewire:main
Oct 30, 2025
Merged

feat(scatter): add color column and category customization support#497
palewire merged 6 commits intochekos:mainfrom
palewire:main

Conversation

@palewire
Copy link
Collaborator

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.

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.
@palewire palewire requested a review from Copilot October 30, 2025 17:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and exclude_from_color_key fields to the ScatterPlot class
  • Updated scatter plot documentation example with color categories, revised text annotations using dw.TextAnnotation objects, 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.

palewire and others added 2 commits October 30, 2025 13:04
…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>
@palewire palewire merged commit bd9b8b7 into chekos:main Oct 30, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant