import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
def sample_lattice_ortho():
lons = np.linspace(0.0, 360.0, 181)[:-1]
lats = np.linspace(-90.0, 90.0, 91)[1:-1]
m = Basemap(projection='ortho', lon_0=120.0, lat_0=40.0,
resolution='i')
m.drawmapboundary(linewidth=0.4, color='k')
m.fillcontinents(color='silver', lake_color='silver')
lat = np.linspace(-90, 90, 101)
for lon in lons:
lon = np.ones(lat.shape) * lon
x, y = m(lon, lat)
x[x > 1e20] = np.nan
y[y > 1e20] = np.nan
m.plot(x, y, linewidth=1, color=linecolor)
lon = np.linspace(0.0, 360.0, 101)
for lat in lats:
lat = np.ones(lon.shape) * lat
x, y = m(lon, lat)
x[x > 1e20] = np.nan
y[y > 1e20] = np.nan
m.plot(x, y, linewidth=1, color=linecolor)
plt.show()
linecolor = '#636363'
sample_lattice_ortho()