Skip to content

fix: sc.pl.paga cax handling with multiple colors - #4319

Open
AdvaitS wants to merge 2 commits into
scverse:mainfrom
AdvaitS:fix/paga-cax
Open

fix: sc.pl.paga cax handling with multiple colors#4319
AdvaitS wants to merge 2 commits into
scverse:mainfrom
AdvaitS:fix/paga-cax

Conversation

@AdvaitS

@AdvaitS AdvaitS commented Aug 22, 2026

Copy link
Copy Markdown

Summary

sc.pl.paga documented cax as a single axes but indexed it as a sequence (cax[icolor]), raising TypeError: 'Axes' object is not subscriptable with multiple colors. It now accepts a single axes (for one colorbar) or a sequence of axes, and raises a clear ValueError when a single axes is given with multiple colorbars.

Test log

$ uv run pytest tests/plotting/legacy/test_paga.py::test_paga_cax -q
1 passed

The `cax` parameter was documented as a single axes but indexed as a
sequence (`cax[icolor]`), raising `TypeError: 'Axes' object is not
subscriptable` when plotting multiple colors. Accept either a single
axes (for one colorbar) or a sequence of axes, and raise a clear error
when a single axes is given with multiple colorbars.

Fixes scverse#4318
@AdvaitS AdvaitS changed the title Fix sc.pl.paga cax handling with multiple colors fix: sc.pl.paga cax handling with multiple colors Aug 22, 2026
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.10%. Comparing base (e6269f5) to head (1a1edb2).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4319      +/-   ##
==========================================
+ Coverage   80.08%   80.10%   +0.02%     
==========================================
  Files         133      133              
  Lines       13424    13429       +5     
==========================================
+ Hits        10750    10757       +7     
+ Misses       2674     2672       -2     
Flag Coverage Δ
hatch-test.low-vers 78.06% <100.00%> (+0.04%) ⬆️
hatch-test.pre 79.97% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/scanpy/plotting/legacy/_tools/paga.py 65.04% <100.00%> (+0.65%) ⬆️

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.

sc.pl.paga raises TypeError when cax is passed with multiple colors

1 participant