gpt4 book ai didi

python - Matplotlib basemap drawcounties 不起作用

转载 作者:行者123 更新时间:2023-11-28 18:29:13 24 4
gpt4 key购买 nike

与标题差不多。我的 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)

输出: enter image description here

最佳答案

drawcoaSTLines() 正在绘制带有白色面的多边形,因此它位于县界线之上。

关于python - Matplotlib basemap drawcounties 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38827756/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com