我有以下Python代码:
m = Basemap(projection='tmerc',
llcrnrlon=-10.56,
llcrnrlat=51.39,
urcrnrlon=-5.34,
urcrnrlat=55.43,
resolution='h',
epsg=29902)
# Fill the globe with blue color
m.drawmapboundary(fill_color='aqua')
# Draw country boundaries
m.drawcountries()
# Fill the continents with the land color
m.fillcontinents(color='coral', lake_color='aqua')
m.drawcoastlines()
lons = [-7.637558, -5.926437, -6.266155]
lats = [54.350155, 54.607868, 53.350140]
x, y = m(lons, lats)
m.scatter(x, y, marker='D', color='m')
plt.show()
当我运行它时,点不会出现在我的地图上。如果我将zorder=0
添加到fillcontinents
,它们确实会出现,但整个贴图是aqua
颜色的。如果我没有zorder=0
并且我使用m.plot
而不是m.scatter
点被绘制出来,但它们之间会出现我不想要的线条
如何使点自行显示,但保留fillcontinents
颜色
可能的解决方案
我在{
m = Basemap(projection='tmerc',
llcrnrlon=-10.56,
llcrnrlat=51.39,
urcrnrlon=-5.34,
urcrnrlat=55.43,
resolution='h',
epsg=29902)
# Fill the globe with blue color
m.drawmapboundary(fill_color='aqua')
# Draw country boundaries
m.drawcountries()
# Fill the continents with the land color
m.fillcontinents(color='coral', lake_color='aqua')
m.drawcoastlines()
lons = [-7.637558, -5.926437, -6.266155]
lats = [54.350155, 54.607868, 53.350140]
x, y = m(lons, lats)
m.scatter(x, y, marker='D', color='m', zorder=2)
plt.show()
我在{}中添加了{}。这是做这件事最像Python的方式吗
相关问题 更多 >
编程相关推荐