Skip to content

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

Open
timtreis wants to merge 1 commit into
mainfrom
fix/issue-615-render-points-z-dropped
Open

Fix render_points(color="z") silently dropping data column (#615)#667
timtreis wants to merge 1 commit into
mainfrom
fix/issue-615-render-points-z-dropped

Conversation

@timtreis
Copy link
Copy Markdown
Member

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.

Test plan

  • New regression test test_render_points_color_by_z_data_column — fails on main, passes on this branch.
  • New edge-case test test_render_points_color_by_z_with_extra_columns — coloring by a non-z column on a frame that also carries z still works.
  • Full non-visual tests/pl/ suite: 297 passed.
  • CI visual baselines unaffected (sanity check on CI).

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 Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.63%. Comparing base (db17a4f) to head (9b0cf72).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #667      +/-   ##
==========================================
+ Coverage   77.61%   77.63%   +0.01%     
==========================================
  Files          11       11              
  Lines        3610     3613       +3     
  Branches      849      850       +1     
==========================================
+ Hits         2802     2805       +3     
  Misses        484      484              
  Partials      324      324              
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 87.40% <100.00%> (+0.04%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

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

2 participants