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
Contour labelling image test failing against Matplotlib main
#2207
Comments
The behaviour change comes from matplotlib/matplotlib#25247. |
Just realised that @greglucas already has a plan for this: matplotlib/matplotlib#25247 (comment) |
I can't say I actually had a plan for this ;) just that I looked at the code within Cartopy and noticed that there was a lot of path manipulation with the clabel subclass, so at first glance it seems like we should address it here rather than in MPL. I wonder if we can get rid of the GeoContourSet altogether now that it is a single PathCollection in MPL? |
So I tried this to just not use and got this. All the other contour tests pass with this commit and that straight dashed line at ~45 north only appears with the call to clabel. I also tried naively changing the |
That is interesting. That first case looks really close to what we want. My initial guess of what is happening here is that we have a contour calculated in data-space. Then that specific one is on the wrapping boundary, so then it gets cut and we try to resplice the paths within the path interpolation code, but then the text gets inserted and messes up that line interpolation portion... That is a wild guess though and I'm not sure how easy it would be to fix that either. |
I have a sketch of a solution at matplotlib/matplotlib#26297. That, combined with my Cartopy commit mentioned above (to not use Or with a smaller font (so we get more labels): |
main
main
Description
I just ran the tests against Matplotlib main, and got an image comparison failure because of the contour labels:
Expected
Actual
The test:
cartopy/lib/cartopy/tests/mpl/test_examples.py
Lines 33 to 72 in c4858e4
I have two questions
Does anyone have a theory why
inline=True
does not seem to work any more? I cannot reproduce the problem with Matplotlib's Contour Label Demo.How would you handle a genuine difference caused by different Matplotlib versions, so that both the main tests and the "minimum package versions" tests still pass?
Full environment definition
Operating system
RHEL7
Cartopy version
main
conda list
The text was updated successfully, but these errors were encountered: