我想绘制一个类似于WRF域的图形,像
那样只有矩形框架而没有任何颜色在域框内。但是,我最接近的是
我该如何编辑我的代码以获得类似的图形?
![The following figure](https://istack.dev59.com/aO3kq.webp)
使用以下代码:-
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)
我该如何编辑我的代码以获得类似的图形?