pythonでデータ分析をして地理情報に表示したいときに使うパッケージはplotlyである。
plotlyのchropleth map(階級区分図)を利用する。
plotlyについてはこちらでサンプルコードが紹介されている。
https://plot.ly/python/choropleth-maps/#world-choropleth-map
またkaggleに記載されている下記の記事はTMDBと組み合わせて世界における映画の本数をプロットしている
https://www.kaggle.com/fabiendaniel/choropleth-map-with-plotly
日本の地図を表示したいので、関係そうなパラメータであるlocationmodeとscopeをいじってみたがうまくいかなかった。
data = dict(type='choropleth', colorscale = 'YIOrRd', locations = df['code'], z = df['total exports'], locationmode = 'USA-states', text = df['text'], marker = dict(line = dict(color = 'rgb(255,255,255)',width = 2)), colorbar = {'title':"Millions USD"} )
plotlyについては下記のリンクを参照する
https://plot.ly/python/reference/#choropleth