New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MAINT] Fix failing tests in prerelease job due to deprecation and bug in matplotlib 3.8.0rc1 #3902
Conversation
I am still unsure about how to fix the second failing test: |
👋 @ymzayek Thanks for creating a PR! Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft. Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.
For new features:
For bug fixes:
We will review it as quick as possible, feel free to ping us with questions if needed. |
Codecov Report
@@ Coverage Diff @@
## main #3902 +/- ##
=======================================
Coverage 91.74% 91.74%
=======================================
Files 134 134
Lines 15733 15735 +2
Branches 3273 3274 +1
=======================================
+ Hits 14434 14436 +2
Misses 757 757
Partials 542 542
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
The second error ( import numpy as np
import matplotlib.pyplot as plt
data = np.arange(0.0, 1, 0.01).reshape(4, 25)
threshold = 1e-06
data = np.ma.masked_inside(data, -threshold, threshold, copy=False)
vmin = data.min()
vmax = data.max()
levels = [0.001] # will pass with [0.01]
_, ax = plt.subplots()
ax.contour(data.copy(), vmin=vmin, vmax=vmax, levels=levels) Here levels is given a value lower than vmin (0.01). If the value of |
Seems to me a bug on matplotlib's side. IIUC vmin and vmax should map data values to colors on the colormap and data values lower or higher than vmin/vmax should be mapped to the lowest/highest color in the colomap. For some reason, vmax is equal to zero when levels argument is less than vmin and vmin is given, hence the error that we get. vmax and vmin should not be affected by the levels parameter. Will open an issue there and confirm, then do a hot fix here. |
ef7b30a
to
ecbfb2b
Compare
The documentation failure doesn't seem to be related. I also failed on the scheduled build on main. Will look into separately. I think this one can be merged |
thanks for the fix and pinging folks on matplotlib |
Changes proposed in this pull request:
ax.remove()
instead of being automatically overwrittentest_displays.py
to get around matplotlib bug [Bug]: ValueError thrown whenlevels
is set to a lower value thanvmin
when usingcontours
method of Axes matplotlib/matplotlib#26531