0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

matplotlib.basemapのbluemarble()のエラーの対処法。

Posted at

下記のページを参考に、Twitterのデータを解析し緯度経度をmatplotlib.basemapに描くときに
発生したエラーとその対処法について示します。

Twitterのデータ解析で参考にしたのが以下のページです。

スタバTwitterデータ位置情報のビジュアライゼーションと分析

これを参考に衛星画像にTwitterデータより取得した緯度経度をプロットしようとしたところ、
以下のエラーが発生しました。

 File "/Users/******/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py", line 3982, in bluemarble
    return self.warpimage(image='bluemarble',scale=scale,**kwargs)
 File "/Users/kawakita/anaconda3/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py", line 4117, in warpimage
    np.concatenate((self._bm_lons,self._bm_lons+360),1)
numpy.core._internal.AxisError: axis 1 is out of bounds for array of dimension 1

どうも、bulemarbleで設定した次元が異なるらしい。
ということで、init,pyの4117行目のコードをいかに修正します。

修正前

    np.concatenate((self._bm_lons,self._bm_lons+360),1)

修正後

    np.concatenate((self._bm_lons,self._bm_lons+360))

これによってエラーは回避され、衛星画像がベースマップとして使用できるようになりました。
同じエラーで困った方の参考になれば幸いです。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?