Skip to content
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

Test failures with Matplotlib 3.5.0b1 #188

Open
QuLogic opened this issue Sep 2, 2021 · 6 comments
Open

Test failures with Matplotlib 3.5.0b1 #188

QuLogic opened this issue Sep 2, 2021 · 6 comments

Comments

@QuLogic
Copy link

QuLogic commented Sep 2, 2021

Building with Matplotlib 3.5.0b1 fails on two tests:

_______________________________________________________________________________________________________________________________________________________ test_gaussian ________________________________________________________________________________________________________________________________________________________
Error: Image files did not match.
  RMS Value: 21.09554109679737
  Expected:  
    /tmp/tmpmwx2uric/test_gaussian.test_gaussian/baseline.png
  Actual:    
    /tmp/tmpmwx2uric/test_gaussian.test_gaussian/result.png
  Difference:
    /tmp/tmpmwx2uric/test_gaussian.test_gaussian/result-failed-diff.png
  Tolerance: 
    20
______________________________________________________________________________________________________________________________________________________ test_reglatlon1 _______________________________________________________________________________________________________________________________________________________
Error: Image files did not match.
  RMS Value: 30.061142323234787
  Expected:  
    /tmp/tmpmwx2uric/test_reglatlon.test_reglatlon1/baseline.png
  Actual:    
    /tmp/tmpmwx2uric/test_reglatlon.test_reglatlon1/result.png
  Difference:
    /tmp/tmpmwx2uric/test_reglatlon.test_reglatlon1/result-failed-diff.png
  Tolerance: 
    20
@QuLogic
Copy link
Author

QuLogic commented Sep 2, 2021

So the problem is that the coast lines 'disappeared'. That's because they have zorder=1 in Cartopy, and contours also have zorder=1 in Matplotlib. With 3.5.0b1, Matplotlib respects plotting order and no longer arbitrarily re-orders artists (matplotlib/matplotlib#18216), so the coast lines are drawn under the contour. The quick fix would be to move the ax.coastlines call later.

I do wonder if we should do something about this in Cartopy and/or Matplotlib.

@jdkloe
Copy link
Contributor

jdkloe commented Sep 9, 2021

I just encountered the same issue. Simply adding zorder=2 to the ax.coastlines() calls solves it.
I modified 1 line in pygrib-2.1.3/test/test_gaussian.py and 3 lines in pygrib-2.1.3/test/test_reglatlon.py. Then all runs again fine with matplotlib 3.5.0.

@QuLogic
Copy link
Author

QuLogic commented Sep 9, 2021

Yes, that will work; we are also fixing this in Cartopy: SciTools/cartopy#1840

jswhit added a commit that referenced this issue Sep 17, 2021
@QuLogic
Copy link
Author

QuLogic commented Oct 9, 2021

Latest Cartopy fixes this for you, but it also changes the results slightly. The limits are a little better and higher, and the new gridline labelling changes the +/- to N/S or E/W.

@jdkloe
Copy link
Contributor

jdkloe commented Jan 27, 2022

New test results from the latest fedora rawhide rebuild look different, but I still see failing tests related to cartopy plots created by the pygrib test suite that do not match expectations. See the attached file:
pygrib_test.tar.gz
I see 3 failing tests now:
test_reduced_gg.test_reduced_gg
test_reduced_ll.test_reduced_ll
test_reglatlon.test_reglatlon2
All 3 seem to have a changed bounding box, especially on the upper side.
For test_reduced_gg the tick label texts changed, they now have added N/S/E/W and an added circle/degree symbol.

Any advice how to change/fix the tests to prevent these failures are welcome.

Software versions used for this test are:
Python 3.10.2, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
Matplotlib: 3.5.1
Freetype: 2.11.1
Cartopy 0.20.1

@QuLogic
Copy link
Author

QuLogic commented May 23, 2022

If you really don't want to change them, I think you can just set the limits of the plot.

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

No branches or pull requests

2 participants