python-training icon indicating copy to clipboard operation
python-training copied to clipboard

Update cartopy training unit

Open dopplershift opened this issue 5 years ago • 0 comments

I put this together to answer a question:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=ccrs.LambertConformal())

# Rectangle in projection coordinates
rect_proj = plt.Rectangle([-500000, -500000], width=800000, height=800000,
                          facecolor='none', edgecolor='tab:blue')
ax.add_artist(rect_proj)

# Rectangle in lon/lat coordinates
rect_geo = plt.Rectangle([-105, 40], width=15, height=15,
                         facecolor='none', edgecolor='tab:red',
                         transform=ccrs.PlateCarree())
ax.add_artist(rect_geo)

ax.coastlines()
ax.set_extent((-120, -65, 20, 55))

It'd be nice to make use of this in our own training.

dopplershift avatar May 05 '20 20:05 dopplershift