【发布时间】:2017-11-22 21:25:41
【问题描述】:
我正在尝试将我的 matplotlib 地图周围的默认框架的设计更改为 lon/lat 白色和黑色圆形“边界框”类型的框架,例如,黑色从 W 90 度延伸到 45 度 W ,和白色从45W到0度等。
为矩形地图的 R 用户开发了一个非常相似的代码(参见:http://menugget.blogspot.co.uk/2012/04/add-frame-to-map.html),但我没有为 Python 用户找到任何东西。
有谁知道 Python 中是否有允许这种框架设计的包?
以下是我在 python 中绘制南极洲的代码。代码下面的图显示了我想要实现的 R 等价物。
代码:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
fig = plt.figure(figsize=(11.7,8.3))
plt.subplots_adjust(left=0.05,right=0.95,top=0.90,bottom=0.05,wspace=0.15,hspace=0.05)
ax = plt.subplot(111)
x1 = -180
x2 = 180
y1 = -90
y2 = 90
m = Basemap(projection='spstere', llcrnrlat=y1,urcrnrlat=y2,llcrnrlon=x1,urcrnrlon=x2,boundinglat=-63,lon_0=180, resolution='l',round=True)
m.drawmeridians(np.arange(0,360,60),labels=[1,1,1,1],linewidth=0.5, fontsize=10, dashes=[1,5])
m.drawparallels(np.arange(-90,90,20),linewidth=0.5, fontsize=10, dashes=[1,5])
m.drawcoastlines(linewidth=0.5)
fig.show()
【问题讨论】:
标签: python matplotlib matplotlib-basemap