Skip to content

fix: support categorical color fields in line, step, and area plots - #1767

Open
senanurcetin wants to merge 5 commits into
holoviz:mainfrom
senanurcetin:fix/1759-categorical-color-line-step-area
Open

senanurcetin wants to merge 5 commits into
holoviz:mainfrom
senanurcetin:fix/1759-categorical-color-line-step-area

Conversation

@senanurcetin

Copy link
Copy Markdown

Summary

Fixes #1759.

This PR adds support for categorical color fields in line, step, and area plots.

Previously, using color="cat" with a categorical field failed when rendering with Bokeh because HoloViews Curve and Area elements do not support direct categorical color mappings.

The fix groups categorical data into separately colored curves or areas, consistent with the existing by= behavior.

Changes

  • Support categorical columns, named indexes, MultiIndex levels, and boolean color fields.
  • Preserve literal colors, numeric color fields, and explicitly specified by groupings.
  • Support Pandas, Polars DataFrame, and Polars LazyFrame.
  • Update plotting-method documentation.
  • Add 33 parameterized regression cases.

Verification

Tested on the exact fork commit c8da30f:

  • 127 plotting and regression tests passed; 2 skipped.
  • 73 Bokeh options tests passed.
  • Ruff lint and formatting checks passed.
  • Git diff checks passed.
  • Nine original categorical regression cases fail on unmodified upstream code and pass with this fix.

The full optional multi-backend test matrix has not been executed.

AI assistance was used in implementation and testing.

Closes #1759.

This branch has not been deployed

No deployments
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.

Fix documentation, or Implement the color option for lineplots, areaplots, and the like

1 participant