我想绘制一个类似于WRF域的数字,如,只有矩形框,在域的框架内没有任何颜色。但是,我最接近的是
使用以下代码: -
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
import pylab as P
def draw_screen_poly( lats, lons, m):
x, y = m( lons, lats )
xy = zip(x,y)
poly = Polygon( xy,alpha=0.1,edgecolor='k',linewidth=1 )
plt.gca().add_patch(poly)
lats = [ 26.1238,29.2537,29.2537,26.1238 ]
lons = [82.5228,82.5228, 87.2772,87.2772 ]
m = Basemap(llcrnrlon=80,llcrnrlat=25,urcrnrlon=90,urcrnrlat=30,
projection='merc', lat_1=27.7,lat_2=60.,lat_0=27.69998,lon_0=85.3,resolution="h")
m.drawcoastlines()
m.drawmapboundary()
m.drawcountries(linewidth=1,color='k')
m.fillcontinents(color='g',lake_color='aqua')
parallels = np.arange(0.,90,1.)
m.drawparallels(parallels,labels=[1,0,0,0],color="gray",fontsize=10)
draw_screen_poly( lats, lons, m )
meridians = np.arange(0.,180.,1.)
m.drawmeridians(meridians,labels=[0,0,0,1],color="gray",fontsize=10)
fig = P.gcf()
P.show()
pngfile = "map_new_domain.pdf".format("avg")
fig.savefig(pngfile)
如何编辑我的代码以获得相似的数字?