Skip to content

swev-id: matplotlib__matplotlib-26342 feat: add ContourSet.set_paths#73

Open
casey-brooks wants to merge 2 commits intomatplotlib__matplotlib-26342from
feat/contourset-set-paths-285
Open

swev-id: matplotlib__matplotlib-26342 feat: add ContourSet.set_paths#73
casey-brooks wants to merge 2 commits intomatplotlib__matplotlib-26342from
feat/contourset-set-paths-285

Conversation

@casey-brooks
Copy link

Summary

  • add ContourSet.set_paths with validation, cache invalidation, and stale updates
  • declare the typing stub for the new setter
  • expand contour tests to cover path replacement, transformed labeling, and unchanged defaults

Testing

  • MPLBACKEND=Agg PYTHONPATH=/workspace/matplotlib/lib LD_LIBRARY_PATH=/root/.nix-profile/lib:/nix/store/qipd93x9gjyiygqk673rd2ssnf8y7jj0-gcc-14.3.0-lib/lib:/nix/store/f8w1i7yisixb9hivzbk0l4ixmf67fjqr-gcc-14.3.0-libgcc/lib .venv/bin/pytest lib/matplotlib/tests/test_contour_set_paths.py -n 0
  • .venv/bin/flake8 lib/matplotlib/contour.py lib/matplotlib/tests/test_contour_set_paths.py
  • MPLBACKEND=Agg PYTHONPATH=/workspace/matplotlib/lib LD_LIBRARY_PATH=/root/.nix-profile/lib:/nix/store/qipd93x9gjyiygqk673rd2ssnf8y7jj0-gcc-14.3.0-lib/lib:/nix/store/f8w1i7yisixb9hivzbk0l4ixmf67fjqr-gcc-14.3.0-libgcc/lib .venv/bin/pytest lib/matplotlib/tests/test_contour.py -k contour -n 0 (fails: MatplotlibDeprecationWarning emitted where PendingDeprecationWarning expected in test_deprecated_apis)

Closes #71

@casey-brooks casey-brooks requested a review from a team December 25, 2025 13:36
@casey-brooks
Copy link
Author

Test & Lint Summary

  • .venv/bin/flake8 lib/matplotlib/contour.py lib/matplotlib/tests/test_contour_set_paths.py (pass: no findings)
  • MPLBACKEND=Agg PYTHONPATH=/workspace/matplotlib/lib LD_LIBRARY_PATH=/root/.nix-profile/lib:/nix/store/qipd93x9gjyiygqk673rd2ssnf8y7jj0-gcc-14.3.0-lib/lib:/nix/store/f8w1i7yisixb9hivzbk0l4ixmf67fjqr-gcc-14.3.0-libgcc/lib .venv/bin/pytest lib/matplotlib/tests/test_contour_set_paths.py -n 0 (pass: 3 passed, 0 failed)
  • MPLBACKEND=Agg PYTHONPATH=/workspace/matplotlib/lib LD_LIBRARY_PATH=/root/.nix-profile/lib:/nix/store/qipd93x9gjyiygqk673rd2ssnf8y7jj0-gcc-14.3.0-lib/lib:/nix/store/f8w1i7yisixb9hivzbk0l4ixmf67fjqr-gcc-14.3.0-libgcc/lib .venv/bin/pytest lib/matplotlib/tests/test_contour.py -k contour -n 0 (fails on baseline: MatplotlibDeprecationWarning raised where PendingDeprecationWarning expected in test_deprecated_apis)

Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for wiring up and the accompanying tests. I left one major comment: after replacing the paths we still leave , , and the axes' cached limits pointing at the previous geometry. That keeps the ContourSet metadata inconsistent (autoscale, sticky edges, etc.). Please recompute the bounds from the new paths and update the cached limits so the setter keeps the object self-consistent.

Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-ran the contour-set review: the new implementation now recomputes /, refreshes the sticky edges, and updates the axes’ data limits after swapping paths. The regression test also verifies that moves when the geometry shifts. Looks good to me.

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