-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcm_2.py
More file actions
41 lines (26 loc) · 922 Bytes
/
cm_2.py
File metadata and controls
41 lines (26 loc) · 922 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
39
40
41
#!/usr/bin/env python3
# -*- coding utf-8 -*-
"""
cm_2.py
Change projection and add gridlines
"""
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import matplotlib.ticker as mticker
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
from matplotlib import rcParams
rcParams['font.size']=6
fig = plt.figure(figsize=(15/2.54,10/2.54))
# a first projection
ax1 = fig.add_subplot(211, projection=ccrs.Mercator(
central_longitude=0))
ax1.coastlines(resolution='110m') # resolutions available 50m and 10m
gl = ax1.gridlines(draw_labels=True)
#a second projection
ax2 = fig.add_subplot(212, projection=ccrs.Mollweide(
central_longitude=180))
# features can be used to include different kinds of back_grounds
ax2.coastlines(resolution='110m')
ax2.gridlines()
plt.savefig('../../figures/cm_2.svg')
plt.show()