You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am running basemap version 1.3.4
Matplotlib 3.8
CentOS 7.8
Using conda.
Python 3.10.2
I got this error.
cs = m.contourf(x,y,pot,levels=clevs, alpha=1,cmap=plt.cm.RdBu_r)
Traceback (most recent call last):
File "/glade/u/home/qwu/gtrSep20/tiegcmnmf22020duskmewmeridicon092420200506sep2120202324paperafreviewmgladepy310.py", line 500, in
cs = m.contourf(x,y,pot,levels=clevs, alpha=1,cmap=plt.cm.RdBu_r)
File "/glade/work/qwu/conda-envs/qwu-env0/lib/python3.10/site-packages/mpl_toolkits/basemap/init.py", line 548, in with_transform
return plotfunc(self,x,y,data,*args,**kwargs)
File "/glade/work/qwu/conda-envs/qwu-env0/lib/python3.10/site-packages/mpl_toolkits/basemap/init.py", line 3704, in contourf
CS.collections,c = self._cliplimb(ax,CS.collections)
File "/glade/work/qwu/conda-envs/qwu-env0/lib/python3.10/site-packages/matplotlib/_api/deprecation.py", line 164, in set
return super().set(instance, value)
AttributeError: can't set attribute
Hi, @qianwu2! Right now, the requirements file defines matplotlib >= 1.5, < 3.8; python_version >= "3.5", so matplotlib 3.8 falls outside the version range that is being tested.
In any case, I thank you for providing this feedback, because soon I will need to increase the upper pin for matplotlib to 3.9. I have not done it yet because I know that matplotlib 3.8 is bringing some changes that will break with basemap right now, so it is not only a matter of updating the requirements file.
falls over for me with AttributeError: property of 'QuadContourSet' object has no setter consistent with this stackoverflow question. Since the ContourSet is now itself a collection, I suspect you just need to pass CS itself to your _cliplimb method.
@rcomer Thanks a lot for pointing to the specific issue. I will try to address it as soon as possible, because the basemap release 1.4.0 should arrive soon, and updating the matplotlib pin to <3.9 is a must in my todo list for 1.4.0.
The fix proposed by @rcomer has been added to all the affected methods (contour, contourf and nightshade), and I have also added some simple tests to the test suite to ensure that now it is working.
Thanks for your help! I will close the issue now, you will be able to use matplotlib 3.8.x with the basemap release 1.4.0, which should take place in one or two days at maximum.
Activity
molinav commentedon Dec 25, 2023
Hi, @qianwu2! Right now, the requirements file defines
matplotlib >= 1.5, < 3.8; python_version >= "3.5", somatplotlib3.8 falls outside the version range that is being tested.In any case, I thank you for providing this feedback, because soon I will need to increase the upper pin for
matplotlibto 3.9. I have not done it yet because I know thatmatplotlib3.8 is bringing some changes that will break withbasemapright now, so it is not only a matter of updating the requirements file.rcomer commentedon Dec 30, 2023
I just tried the first (
contour) and last (nightshade) examples from the docs with Matplotlib v3.8. The same line in those methods,falls over for me with
AttributeError: property of 'QuadContourSet' object has no setterconsistent with this stackoverflow question. Since theContourSetis now itself a collection, I suspect you just need to passCSitself to your_cliplimbmethod.molinav commentedon Jan 6, 2024
@rcomer Thanks a lot for pointing to the specific issue. I will try to address it as soon as possible, because the
basemaprelease 1.4.0 should arrive soon, and updating thematplotlibpin to<3.9is a must in my todo list for 1.4.0.Fix QuadContourSet breaking change becoming Artist subclass
molinav commentedon Jan 7, 2024
The fix proposed by @rcomer has been added to all the affected methods (
contour,contourfandnightshade), and I have also added some simple tests to the test suite to ensure that now it is working.Thanks for your help! I will close the issue now, you will be able to use
matplotlib3.8.x with thebasemaprelease 1.4.0, which should take place in one or two days at maximum.qianwu2 commentedon Jan 7, 2024