Skip to content

Colour cells by group, shade by member, in both legend-muting modes (#181) - #193

Open
jepegit wants to merge 3 commits into
cursor/174-open-project-append-713afrom
cursor/181-group-colours-713a
Open

jepegit wants to merge 3 commits into
cursor/174-open-project-append-713afrom
cursor/181-group-colours-713a

Conversation

@jepegit

@jepegit jepegit commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #181.

Stacked PR (merging is blocked for the agent's token): #189 (#186) → #190 (#184) → #191 (#187) → #192 (#174) → this (#181). Base is cursor/174-open-project-append-713a; retarget to main once #192 lands.

Problem

Turning Mute by group off recoloured the figure. The app colorway (collect._apply_colorway, used by the safe/muted schemes) was keyed by Plotly legendgroup, which cellpy sets to the group id when muting is on but to the cell name when it is off — so every cell got its own colour and the group identity was lost. With muting on, the opposite problem: cells of one group were painted in identical colours and could not be told apart.

Change

  • collect.cell_groups(records) maps trace names (batch keys and group names) to group ids; plotting.summary_figure and plotting.cycles_figure (per_cycle layout) pass it to figure_json(cell_groups=…).
  • _apply_colorway buckets per-cell traces by group and paints each group with one hue — the scheme colour at (group − 1) % len, so the safe scheme matches the sidebar swatches, or for the cellpy scheme the colour cellpy already gave the group — fanned into lightness shades per member (_shade_series, HLS). Singletons keep the base colour exactly.
  • Colours are now identical whether muting is on or off; muting only decides what a legend click toggles.
  • Group-average traces and per_cell cycle facets (coloured by cycle) keep the previous order-of-appearance behaviour.
  • Colouring runs before legend truncation in _restyle so truncated names cannot collide.
  • Also sweeps the solved name of groups #187 issue files out of 01-current-issues (left behind by Name groups: library labels, legend captions, manifest + journal persistence (#187) #191).

Tests

New section in tests/test_core.py: cell_groups map, _shade_series, summary colours follow groups for every scheme × both muting modes, both muting modes give identical colours, Cycles pane follows groups while per_cell stays coloured by cycle, group averages keep their swatch colours. Full suite green locally.

Walkthrough

Demo cells, two cells put in group 1 and one in group 2, Safe scheme: the group-1 cells are two shades of the swatch blue, group 2 is orange; unticking and re-ticking Mute by group leaves the colours unchanged; the Cycles tab follows the same grouping.

issue181_group_colours_muting_walkthrough.mp4

Docs

plot-appearance.md, group-legend-muting.md, README feature line, llms-full.txt regenerated.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

cursoragent and others added 3 commits October 3, 2026 23:33
…ng modes (#181)

The app colorway was keyed by Plotly legendgroup, which cellpy sets to the
cell name when group_legend_muting is off, so turning Mute by group off
recoloured every cell individually and lost the group identity. Pass a
trace-name -> group map (collect.cell_groups) into _apply_colorway and paint
each group with one hue - the scheme colour at (group - 1), matching the
sidebar swatches, or cellpy's own group colour for the cellpy scheme -
fanned into lightness shades per member so cells of a group stay
distinguishable. Group averages and per_cell cycle facets are unchanged.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
…oup-colours-713a

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>

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.

2 participants