Skip to content

Avoid using deprecated get_axis_bgcolor() method with newer matplotlib #292

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

Merged
merged 2 commits into from
May 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/mpl_toolkits/basemap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@

:func:`addcyclic`: Add cyclic (wraparound) point in longitude.
"""
from distutils.version import LooseVersion
from matplotlib import __version__ as _matplotlib_version
from matplotlib.cbook import is_scalar, dedent
# check to make sure matplotlib is not too old.
_mpl_required_version = '0.98'
_matplotlib_version = LooseVersion(_matplotlib_version)
_mpl_required_version = LooseVersion('0.98')
if _matplotlib_version < _mpl_required_version:
msg = dedent("""
your matplotlib is too old - basemap requires version %s or
Expand Down Expand Up @@ -1649,7 +1651,10 @@ def drawmapboundary(self,color='k',linewidth=1.0,fill_color=None,\
# if no fill_color given, use axes background color.
# if fill_color is string 'none', really don't fill.
if fill_color is None:
fill_color = ax.get_axis_bgcolor()
if _matplotlib_version >= '2.0':
fill_color = ax.get_facecolor()
else:
fill_color = ax.get_axis_bgcolor()
elif fill_color == 'none' or fill_color == 'None':
fill_color = None
limb = None
Expand Down Expand Up @@ -1793,7 +1798,10 @@ def fillcontinents(self,color='0.8',lake_color=None,ax=None,zorder=None,alpha=No
# get current axes instance (if none specified).
ax = ax or self._check_ax()
# get axis background color.
axisbgc = ax.get_axis_bgcolor()
if _matplotlib_version >= '1.5':
axisbgc = ax.get_facecolor()
else:
axisbgc = ax.get_axis_bgcolor()
npoly = 0
polys = []
for x,y in self.coastpolygons:
Expand Down