如何增加绘图密度?

2024-09-28 22:23:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我在试着增加我在地图上的剖面线的密度。这就是我目前所做的,我不能让任何东西在我的地图上出现。我想要轮廓值小于0.05(sig p-valuea)。重复我想要的散列方法并不能解决问题。在

levels = [spnewdata[:,:,1].min(), 0.05] cs1 = plt.contour(x, y, spnewdata[:,:,1],levels=levels, colors='none', hatch='X', alpha=0)

编辑: 下面是我用来制作地图的代码的一个更完整的形式。我试过plt.contourplt.contourf两种方法都没有用。但是我知道数据中应该有低于0.05的值,所以我知道这不是问题所在。在

import matplotlib as mpl
import matplotlib.pylab as plt

plt.figure(1,figsize=(10, 8))
 # Setting a cylindrical coordinate map
 map = Basemap(projection='cyl',\
        llcrnrlat=LLlat,urcrnrlat=URlat,\
        llcrnrlon=LLlon,urcrnrlon=URlon,\
        rsphere=6371200.,resolution='i')
map.drawcoastlines(linewidth=0.5) # Draw some coastlines
lons,lats = map(lon,lat) # Setting up the grid in cylindrical coords.
cs = plt.contourf(lons,lats,spnewdata[:,:,0],np.arange(-.3,.4,.1),cmap=plt.cm.RdYlBu, extend='both')
x, y =(lons, lats)

levels = [spnewdata[:,:,1].min(), 0.05]
cs1 = plt.contour(x, y, spnewdata[:,:,1],levels=levels, colors='none', hatch='X', alpha=0)`

Tags: 方法alphanonemap地图pltmincontour