【发布时间】:2017-07-06 22:38:53
【问题描述】:
我正在映射纬度、经度,然后在 cartopy 上绘制一个单独的值。
如何根据名为 klist 的列表使点像热图一样着色?我找不到任何可以与 cartopy 一起使用的 sn-ps 代码
该列表具有我想要根据值的大小着色的值范围。
# Define a Cartopy 'ordinary' lat-lon coordinate reference system.
crs_latlon = ccrs.PlateCarree()
def make_plot(projection_name, projection_crs):
ax = plt.axes(projection=projection_crs)
# Set display limits to include a set region of latitude * longitude.
# (Note: Cartopy-specific).
ax.set_extent((-65.0, -62, 44, 45.5), crs=crs_latlon)
# Add coastlines and meridians/parallels (Cartopy-specific).
ax.coastlines(linewidth=0.2, color='black')
ax.gridlines(crs=crs_latlon, linestyle='-')
# Mark some particular places with a small circle and a name label...
# Define some test points with latitude and longitude coordinates.
#city_data = [('Halifax, NS', 44.67, -63.61)]
plt.plot(lon,lat,marker='x', markersize=1.0, markeredgewidth=2.5,
markerfacecolor='black',
transform=crs_latlon)
# Add a title, and display.
iplt.show("Mission #1: Attenuation Coeffiecient")
def main():
# Demonstrate with two different display projections.
make_plot('Equidistant Cylindrical', ccrs.PlateCarree())
if __name__ == '__main__':
main()
【问题讨论】:
-
你应该让你的代码成为 MWE。就目前而言,这些模块不是
imported。此外,klist不会出现在您的代码中。它真的是一个列表,一个np.array...?无论如何,最好有一个带有随机/垃圾数据的klist用于测试目的。
标签: python python-3.x matplotlib scientific-computing cartopy