Skip to content

Fix boolean contour defaults (swev-id: matplotlib__matplotlib-24870)#53

Open
casey-brooks wants to merge 2 commits intomatplotlib__matplotlib-24870from
work/auto-bool-contour-273
Open

Fix boolean contour defaults (swev-id: matplotlib__matplotlib-24870)#53
casey-brooks wants to merge 2 commits intomatplotlib__matplotlib-24870from
work/auto-bool-contour-273

Conversation

@casey-brooks
Copy link

Summary

  • detect boolean Z arrays before type conversion
  • default auto contour levels for bool inputs to binary thresholds
  • add regression coverage for bool, masked, and lognorm cases

Testing

  • PYTEST_ADDOPTS='-W ignore::DeprecationWarning' MPLBACKEND=Agg PYTHONPATH=/workspace/matplotlib/lib LD_LIBRARY_PATH=/nix/store/qipd93x9gjyiygqk673rd2ssnf8y7jj0-gcc-14.3.0-lib/lib:/nix/store/f8w1i7yisixb9hivzbk0l4ixmf67fjqr-gcc-14.3.0-libgcc/lib:/nix/store/4wdz42ns29ys6fm1xak68bnp51nxhd2s-zlib-1.3.1/lib .venv/bin/pytest lib/matplotlib/tests/test_contour.py -k 'bool'
  • PYTHONPATH=/workspace/matplotlib/lib .venv/bin/flake8 lib/matplotlib/contour.py lib/matplotlib/tests/test_contour.py

Resolves #43

@casey-brooks
Copy link
Author

Test & Lint Summary

  • PYTEST_ADDOPTS='-W ignore::DeprecationWarning' MPLBACKEND=Agg PYTHONPATH=/workspace/matplotlib/lib LD_LIBRARY_PATH=/nix/store/qipd93x9gjyiygqk673rd2ssnf8y7jj0-gcc-14.3.0-lib/lib:/nix/store/f8w1i7yisixb9hivzbk0l4ixmf67fjqr-gcc-14.3.0-libgcc/lib:/nix/store/4wdz42ns29ys6fm1xak68bnp51nxhd2s-zlib-1.3.1/lib .venv/bin/pytest lib/matplotlib/tests/test_contour.py -k 'bool' (6 passed, 0 failed)
  • PYTHONPATH=/workspace/matplotlib/lib .venv/bin/flake8 lib/matplotlib/contour.py lib/matplotlib/tests/test_contour.py (no issues)

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 the boolean default levels and adding coverage. Please also update the public docs (Axes.contour/contourf docstrings and What's New) to reflect the new behaviour so the issue is fully resolved.

@casey-brooks
Copy link
Author

Hi @noa-lucent — I've added the Axes.contour/contourf docstring note about boolean Z inputs and documented the change in What's New. Re-ran the focused contour tests and flake8; everything is green. Ready for another look when you have a chance.

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.

Docs look good now—thanks for adding the What’s New entry and docstring note. Approving.

@rowan-stein rowan-stein changed the title Fix boolean contour defaults Fix boolean contour defaults (swev-id: matplotlib__matplotlib-24870) Dec 25, 2025
@rowan-stein rowan-stein changed the base branch from main to matplotlib__matplotlib-24870 December 25, 2025 12:35
@rowan-stein rowan-stein requested a review from a team December 25, 2025 12:35
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.

[ENH] Auto-detect bool arrays passed to contour()/contourf() (ID: 273)

2 participants