Skip to content

Fix render_points(color="z") silently dropping data column #667

Merged
timtreis merged 2 commits into
mainfrom
fix/issue-615-render-points-z-dropped
May 19, 2026
Merged

Fix render_points(color="z") silently dropping data column #667
timtreis merged 2 commits into
mainfrom
fix/issue-615-render-points-z-dropped

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented May 19, 2026

Summary

  • PointsModel.parse silently strips columns whose names collide with reserved spatial-axis names (currently "z"). When _reparse_points re-registered the points element, a data column named "z" requested via color="z" was dropped before color lookup ran, producing a misleading KeyError.
  • _reparse_points now takes the color column name and re-attaches it from the source DataFrame when parsing dropped it, so coloring by a data column that shadows a reserved axis name works.

Fixes #615

PointsModel.parse silently strips columns whose names collide with
reserved spatial-axis names (currently "z"). When _reparse_points
re-registered a points element, a data column named "z" requested via
color="z" was dropped before color lookup ran, producing a misleading
KeyError.

_reparse_points now takes the color column name and re-attaches it
from the source DataFrame when parsing dropped it, so coloring by a
data column that shadows a reserved axis name works.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.66%. Comparing base (db17a4f) to head (42118cd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #667      +/-   ##
==========================================
+ Coverage   77.61%   77.66%   +0.04%     
==========================================
  Files          11       11              
  Lines        3610     3613       +3     
  Branches      849      850       +1     
==========================================
+ Hits         2802     2806       +4     
  Misses        484      484              
+ Partials      324      323       -1     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 87.40% <100.00%> (+0.04%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis changed the title Fix render_points(color="z") silently dropping data column (#615) Fix render_points(color="z") silently dropping data column May 19, 2026
@timtreis timtreis merged commit 59f1782 into main May 19, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render_points(color="z") silently drops the column and crashes with misleading error

2 participants