Description
This is just copied from #10918 (comment) to make it easier to follow. xref SciTools/cartopy#1126
Bug report
It turns out that passing named arguments for everything broke Cartopy a bit because the first parameter of
imshow
there isimg
, notX
.
It's also started explicitly passingdata=None
to all wrappedAxes
methods that accept labelled data, which is slightly problematic since_preprocess_data
is not public.
Sorry about that. It doesn't look too hard to make pyplot pass defaultless arguments positionally instead of as keywords if you'd like.
I guess you prefer not passing data through when it's None? (There's a plan to make _preprocess_data public too but that's a side point.) Although they were already passing it before (at least in some cases, didn't check carefully) so I'm not sure what changed?
We probably want to keep compatibility with old Cartopy, so we should change the positional arguments at least.
As to data, it was never explicit before, but caught by
**kwargs
. If never passed, it would not appear at all in the final call. Now it's there explicitly (even ifNone
). I'm not sure if it should or should not be explicit in the signature, but it would be best if it's not passed whenNone
at the very least.
Code for reproduction
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import numpy as np
# First problem
ax = plt.axes(projection=crs.PlateCarree())
plt.imshow(np.zeros((100, 100)))
# Second problem
plt.pcolormesh(np.zeros((100, 100)))
Matplotlib version
- Operating system: Fedora 28
- Matplotlib version: 3.0.0
- Python version: 3.6.5
- Other libraries: Cartopy 0.16