Skip to content

stanhue v1.1.0 — overlap-aware coloring

Choose a tag to compare

@chansigit chansigit released this 05 Sep 03:58
· 2 commits to main since this release

What's new

Overlap-aware coloring

Categories that overlap in the 2D embedding no longer receive light/dark shades of the same hue.

  • New parameters overlap_aware=True and overlap_threshold=0.1 in both Python and R.
  • Overlap is measured as grid-based neighbor-label mixing, symmetrized with max, so a rare population sitting inside a big one is detected.
  • ≤ palette size: colors are handed out in CIELAB farthest-point order (anchored on white), then overlapping pairs are pushed apart by ΔE. Two categories now get e.g. dark red + dark green instead of light blue + dark blue.
  • > palette size: two-level greedy. Group dominants pick offsets, other members pick slots within their group's palette segment, maximizing overlap-weighted CIELAB ΔE. Non-overlapping categories keep their previous slot, so there is no cascade of color changes.
  • overlap_aware=False reproduces the v1.0.0 algorithm exactly.
  • The R implementation produces identical output to Python on all test fixtures.

Packaging

  • pip install stanhue now installs a proper stanhue package: from stanhue import assign_celltype_colors. The standalone script lives at stanhue/scatter_colormap.py.
  • Added MIT LICENSE; sdist no longer bundles gallery images.