LoginSignup
0
0

More than 5 years have passed since last update.

matplotlib.basemapのエラーの対処法。

Last updated at Posted at 2018-08-31

Pythonでmatplotlib.basemapを使って地図を描こうと試したとき、
エラー(AttributeError: 'AxesSubplot' object has no attribute 'get_axis_bgcolor')がでて困りました。
その対処法がわかったの共有します。

matplotlibをつかって地図を描きたいかたは、このページをご参考にしてください。

matplotlib.basemapで簡単にマップを描画する

このページを参考にして、matplotlib.basemapのモジュールをインストールします。
そして、このページにあるコードを実行すると、以下のエラーがでてきます。

  File "/Users/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py", line 1767, in fillcontinents
    axisbgc = ax.get_axis_bgcolor()
AttributeError: 'AxesSubplot' object has no attribute 'get_axis_bgcolor'

'init.py'のなかの1767行目のaxixbgc = ax.get_axis_bgcolor()でエラーがでているらしい。
ax.get_axis_bgcolorは使えない、ということです。

このコマンド部分を、以下に修正します。

axixbgc = ax.get_fc()

__init__.py
       # get axis background color. 
        axisbgc = ax.get_fc() #修正部分
        npoly = 0
        polys = []

これによって、matplotlib.basemapにて地図が描けるようになりました。
同じ問題が発生した方に参考になれば幸いです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0