-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcm_1_3.py
More file actions
38 lines (27 loc) · 889 Bytes
/
cm_1_3.py
File metadata and controls
38 lines (27 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
cm_1_3.py
projection vs transform
"""
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(5,3))
# the great interest with cartopy is its ability to be
# integrated into the pyplot environnement
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
# this becomes necessary if you plot data that is not in
# the same projection
ax.set_xlim(-100,30)
ax.set_ylim(0,90)
# add coastlines
ax.coastlines()
# Point 1
LON_P, LAT_P = (2.4, 48.8)
ax.plot(LON_P,LAT_P,'bo', transform=ccrs.Geodetic())
LON_NY, LAT_NY = -75, 43
ax.plot(LON_NY,LAT_NY,'ro', transform=ccrs.Geodetic())
ax.plot([LON_P,LON_NY],[LAT_P,LAT_NY],'--',transform=ccrs.PlateCarree())
ax.plot([LON_P,LON_NY],[LAT_P,LAT_NY],'-',transform=ccrs.Geodetic())
plt.savefig('../../figures/OneTrajectory.svg',bbox_inches='tight')
plt.show()