【发布时间】:2017-07-25 21:29:21
【问题描述】:
我使用 mpl_toolkits.basemap.Basemap() 函数成功绘制了一个多边形。之后,我尝试将一些 (x,y) 点作为散点图添加到底图上。它给出了一条弃用警告消息,并且不绘制散点图(即使仍然绘制了早期的 shapefile)。以下是代码块(请理解已经加载了必要的库):
fname = "../DATA/GIS/IL_State_ln"
m = Basemap(llcrnrlon=-92.,llcrnrlat=36.8,urcrnrlon=-86.5,urcrnrlat=43.,
resolution='i', projection='tmerc', lat_0 = 36.5, lon_0 = -91.8)
m.readshapefile(fname, 'mygeom')
x = [-90., -91.2, -88.]
y = [38., 37.7, 42.]
m.plot(x,y)
plt.show()
弃用警告消息是:
/home/serenewiz/miniconda3/envs/onering/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py:3260: MatplotlibDeprecationWarning: The ishold function was deprecated in version 2.0.
b = ax.ishold()
/home/serenewiz/miniconda3/envs/onering/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py:3269: MatplotlibDeprecationWarning: axes.hold is deprecated.
See the API Changes document (http://matplotlib.org/api/api_changes.html)
for more details.
ax.hold(b)
仅供参考,版本为:Python(3.5)、matplotlib (2.0.0) 和 basemap(1.0.7)。
我在发帖之前参考了以下链接,但我仍然无法解决问题: https://github.com/matplotlib/matplotlib/issues/7808
【问题讨论】:
标签: python matplotlib gis matplotlib-basemap