'AxesSubplot' object has no attribute '

2019-04-16 07:42发布

问题:

I am trying to run Basemap examples from here and I am facing an error 'AxesSubplot' object has no attribute 'get_axis_bgcolor'. When I try first example from the site I should receive contours black, water blue and land coral, but in my case boundaries are black but both water and land are blue

I am using: -Python 3.5.5 -Matplotlib 2.2.2

Would appreciate any help.

回答1:

Basemap (even current latest version 1.0.7) is using deprecated Matplotlib command (see: matplotlib.org/api/_as_gen/…). This command ax.get_axis_bgcolor() needs to be replaced by ax.get_fc() in the file __init__.py found in the ...\lib\pythonX.X\site-packaged\mpl_toolkits\basemap directory.

There are instances in the following two functions drawmapboundary() and fillcontinents().

Save the edits, then re-start and run the python script.