-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_plot.py
More file actions
29 lines (23 loc) · 863 Bytes
/
Copy pathtest_plot.py
File metadata and controls
29 lines (23 loc) · 863 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
import matplotlib
matplotlib.use('Agg') # use non-interactive backend for testing
import matplotlib.pyplot as plt
from geoafrica import boundaries, viz
print("Fetching Nigeria...")
nigeria = boundaries.get_country("Nigeria")
print(nigeria.head())
nigeria.plot(color='lightgreen', edgecolor='black', figsize=(6, 6))
plt.title("Nigeria - Country Outline")
plt.savefig("test_nigeria.png")
print("Saved Nigeria static map.")
print("Fetching States...")
states = boundaries.get_admin("Nigeria", level=1)
print(states.head(3))
states.plot(cmap='Set3', edgecolor='black', figsize=(8, 8))
plt.title("Nigeria - State Boundaries")
plt.savefig("test_states.png")
print("Saved States static map.")
print("Creating interactive map...")
interactive_map = viz.quick_map(states)
interactive_map.save("test_map.html")
print("Saved interactive map.")
print("Tests passed.")