Skip to content

feat: scanpy UMAP support + palette= kwarg (closes #11) - #26

Open
symoon9 wants to merge 4 commits into
mainfrom
feat/scanpy-support
Open

feat: scanpy UMAP support + palette= kwarg (closes #11)#26
symoon9 wants to merge 4 commits into
mainfrom
feat/scanpy-support

Conversation

@symoon9

@symoon9 symoon9 commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

Scanpy UMAP support + palette= kwarg, plus three follow-up fixes.

Core (closes #11)

  • _artists.py: _continuous_artists detects unlabeled/_nolegend_ PathCollection with set_array() (continuous UMAP); _labeled_artists falls back to direct collection scan when no ax.legend() (categorical UMAP)
  • _ctx.py / _studio.py: palette: dict[str, str] | None = None parameter on studio() → forwarded to _PanelCtx
  • colors.py: Custom mode when palette= is supplied — applies label→hex mapping, pre-fills Manual pickers

PathCollection color/alpha fix (closes #27)

  • _set_artist_color: preserves existing facecolor alpha; only syncs edgecolor when originally visible
  • _opacity.py: reads effective alpha from facecolor RGBA channel (not artist-level) for PathCollection; clears artist-level alpha after setting to prevent double-multiplication

Smart mode hidden (closes #28)

  • "Smart" removed from Colors ToggleButtons options; logic kept in code

Ticks section (closes #29)

  • New style/_ticks.py: set_tick_labels_visible, set_xtick_rotation, set_tick_interval
  • New widget/_sections/ticks.py: X/Y label On/Off toggles, x-rotation slider (0°–90°, step 15°), X/Y interval text inputs

Notebook

  • examples/scanpy_umap.ipynb: requires scanpy (removed synthetic fallback); covers categorical UMAP + palette=, continuous UMAP colormap, heatmap, violin

Test plan

  • All 69 tests pass (pytest tests/ -q)
  • _set_artist_color preserves alpha; no double-alpha after set_series_alpha
  • Ticks section renders without error

🤖 Generated with Claude Code

symoon9 and others added 3 commits April 26, 2026 23:29
- Extend _continuous_artists to detect unlabeled/nolegend PathCollections
  (scanpy continuous UMAP with set_array())
- Extend _labeled_artists with no-legend fallback for scanpy categorical UMAP
  (multiple PathCollections per category, no ax.legend())
- Add palette: dict | None to _PanelCtx and studio() signature
- Colors section shows "Custom" mode when palette= is provided; pre-fills
  Manual pickers from the palette dict

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Demonstrates categorical UMAP with palette= kwarg, continuous UMAP
colormap controls, mixed figure, and the programmatic style API.
Falls back to synthetic data when scanpy is not installed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…API sections

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion (#29)

- _artists.py: _set_artist_color preserves facecolor alpha and only syncs
  edgecolor when originally visible — fixes color change on scanpy scatters
- _opacity.py: use facecolor RGBA as alpha source of truth for PathCollection;
  set_alpha(None) after to prevent double-multiplication (artist×face alpha)
- colors.py: remove Smart from ToggleButtons options (code preserved)
- style/_ticks.py + widget/_sections/ticks.py: new Ticks section with
  x/y label visibility, x-tick rotation, x/y tick interval controls
- scanpy_umap.ipynb: require scanpy; drop HAS_SCANPY synthetic fallbacks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant