Skip to content

🤖 split poly meshes for mixed pattern and solid colors#5590

Draft
KristianHolme wants to merge 2 commits intoMakieOrg:masterfrom
KristianHolme:kh/barplot-color-pattern
Draft

🤖 split poly meshes for mixed pattern and solid colors#5590
KristianHolme wants to merge 2 commits intoMakieOrg:masterfrom
KristianHolme:kh/barplot-color-pattern

Conversation

@KristianHolme
Copy link
Copy Markdown
Contributor

Description

Fixes #5589

Summary

Improves handling of per-element color that mixes solid colors and Makie.Pattern / LinePattern, and multiple distinct patterns, for recipes that merge geometry into meshes (notably poly and barplot via the shared pipeline).

Motivation

A single merged mesh cannot combine vertex-style color with pattern texture in one draw the way the current pipeline expects. The same applies when several different patterns are used. Previously this showed up as awkward failures or inconsistent behavior; this change makes the behavior explicit and consistent.

Changes

Poly: Detect when mesh paint must be split (poly_mesh_patterns_need_split), remove/rebuild mesh subplots when meshes / color update, optionally emit one mesh! per submesh when needed, and keep mesh children ordered before stroke (lines!).
register_colormapping!: Handle color as an array of patterns (including all-pattern arrays with allequal / not), and error with clear messages when colorants and patterns are mixed in one array in contexts that still use a single merged mesh (e.g. raw mesh!).
color_per_mesh: Introduce mesh_vertex_paint_eltype so expanded per-vertex paint uses a concrete Union{...} when types differ, instead of relying on typejoin ending up as Any.
ImagePattern / LinePattern: Implement isequal, hash, and == so pattern identity works with allequal and similar logic.

Tests

New isolated tests in Makie/test/isolated/mesh_vertex_colors.jl (included from runtests.jl): mesh_vertex_paint_eltype, color_per_mesh, and resolve smoke tests for barplot with patterns and mixed solid + pattern colors.

Type of change

Delete options that do not apply:

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Added an entry in CHANGELOG.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

🤖 Written by Cursor

- Poly updates mesh children when color mixes AbstractPattern with Colorants or uses multiple distinct patterns
- Add mesh_vertex_paint_eltype and fix color_per_mesh for heterogeneous paint
- Extend register_colormapping! for pattern arrays with clear errors for invalid mixes
- Add isequal, hash, and == for ImagePattern and LinePattern
- Add isolated tests for mesh vertex paint and barplot/poly resolve

Made-with: Cursor
@github-project-automation github-project-automation Bot moved this to Work in progress in PR review Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Work in progress

Development

Successfully merging this pull request may close these issues.

Barplot does not support combination of colors and patterns

1 participant