-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path5.cartopy_map.py
More file actions
26 lines (23 loc) · 826 Bytes
/
5.cartopy_map.py
File metadata and controls
26 lines (23 loc) · 826 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
import pandas as pd
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
birddata = pd.read_csv("bird_tracking.csv")
bird_names = pd.unique(birddata.bird_name)
# To move forward, we need to specify a
# specific projection that we're interested
# in using.
proj = ccrs.Mercator()
plt.figure(figsize=(10,10))
ax = plt.axes(projection=proj)
ax.set_extent((-25.0, 20.0, 52.0, 10.0))
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.OCEAN)
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(cfeature.BORDERS, linestyle=':')
for name in bird_names:
ix = birddata['bird_name'] == name
x,y = birddata.longitude[ix], birddata.latitude[ix]
ax.plot(x,y,'.', transform=ccrs.Geodetic(), label=name)
plt.legend(loc="upper left")
plt.show()