Plotting a map with matplotlib basemap - horribly slow

筅森魡賤 提交于 2019-12-07 13:30:29

问题


Plotting a very, very simple map of only europe in matplotlib / basemap takes so much time (around 10 seconds!). This is just unreal!? Setting of resolution is only "l" (low).

Here is the very simple code:

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

m = Basemap(projection='stere',lon_0=5,lat_0=90.0,rsphere=6371200.,\
        llcrnrlon=-25.0,urcrnrlon=72.0,llcrnrlat=26.0,urcrnrlat=65.0,resolution='l')

m.drawcoastlines(linewidth=0.2)
m.drawcountries(linewidth=0.2)
plt.savefig('/var/www/map.png')

I need to plot hundreds of these maps every 2 hours. This would be impossible? :( Only idea is: Create an empty Basemap and try to draw boundaries with a shapefile.

Regards, John

来源:https://stackoverflow.com/questions/28127331/plotting-a-map-with-matplotlib-basemap-horribly-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!