就像书名上说的那样。我的drawcounties命令被忽略了,没有任何错误。它是不是只画在某些投影上?文件上没有这么说。在
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, shiftgrid
import scipy
def BasemapParameters():
"""
Sets up basemap.
"""
m = Basemap(projection='mill', llcrnrlon = 230, llcrnrlat = 27,
urcrnrlat = 45, urcrnrlon = 261,
area_thresh = 1000., resolution='i')
m.drawcounties(linewidth=0.5)
m.drawcoastlines(linewidth=0.7)
m.drawcountries(linewidth=0.5)
m.drawstates(linewidth=0.5)
m.drawmapboundary(linewidth=0.7)
def SavePlot(lvl,parameter,region,hour,padding):
"""
Saves figure to file with given properties
"""
plt.savefig('{0}_{1}_{2}_{3}.png'.format(lvl,parameter,region,hour),bbox_inches='tight',pad_inches = padding)
plt.close("all")
print(' "{0}_{1}_{2}_{3}.png" created.'.format(lvl,parameter,region,hour))
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
BasemapParameters()
SavePlot('sfc','3hrpcp','sw','000',.07)
尝试在drawcountries中设置zorder=20(或更高的值),将郡线放在国家的顶部。另请参见https://github.com/matplotlib/basemap/issues/324。在
白色的海岸线在绘制,所以绘制的是多边形。在
相关问题 更多 >
编程相关推荐