How to do it…

Enter the following in a Jupyter code cell and run it:

import cartopy.crs as ccrs
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(1, 1, 1,
projection=ccrs.Mollweide())
ax.coastlines()
ax.stock_img()
rj_lat, rj_lon = -22.91, -43.18
bj_lat, bj_lon = 39.90, 116.41
plt.plot([rj_lon, bj_lon], [rj_lat, bj_lat],
color='brown', lw=2, marker='o', ms=10,
transform=ccrs.Geodetic())
plt.text(rj_lon, rj_lat-8, 'Rio de Janeiro',
fontsize=14,
transform=ccrs.Geodetic())
plt.text(bj_lon-7, bj_lat-9, 'Beijing',
fontsize=14, horizontalalignment='right',
transform=ccrs.Geodetic())
None

When this code is executed, we get the following output:

>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset