; v5 p% x) g! M% x/ X$ }2 M
1. 海岸线 Basemap.drawcoaslines()5 l5 C( K6 Z4 L2 s- W
2. 国界线 Basemap.drawcountries()" p3 i: E- ] j7 `* Y
特别要注意国界线有无争议,此处主要说明basemap画国界线的用法,实际国界线以我们国家(中国)制作的地图为准! . F; `9 V7 S! |# u7 x: E( E7 [7 e
3. 州界线 Basemap.drawstates(),主要针对美洲
7 e. Z6 b/ F, W import numpy as np. p( v+ ~2 Z# g Q( G1 P- s1 z
import matplotlib.pyplot as plt9 ?+ t6 m* \9 a$ l
from mpl_toolkits.basemap import Basemap
7 b# N3 E. k( Y; _0 ~
6 B$ q! U& s/ S0 C" ` map = Basemap()
" S j( p9 b2 _) q map.drawcoastlines(color=r, linewidth=.5). Y6 u4 i/ P/ A4 t8 U
map.drawcountries(color=g, linewidth=.25)
- p( Q- X7 r, B map.drawstates(color=b, linewidth=.2)
4 n0 ]6 [5 y- ]) n map.drawparallels(circles=np.linspace(-90, 90, 7),3 x* b8 T4 ^( K8 N
labels=[1, 0, 0, 0], color=gray)' J/ H$ I1 X8 [3 R K
map.drawmeridians(meridians=np.linspace(-180, 180, 13),9 v' e B h: H0 ?* L' G5 U
labels=[0, 0, 0, 1], color=gray)3 f! O* C7 [; A) L/ }
plt.show() ( R, Y- r2 {. \/ f! \
& K; ?" Z2 j) J 4. 用不同颜色填充海洋和陆地9 f: s7 }) z1 X5 F4 Z" }9 v- V
4.1 海洋 Basemap.drawmapboundary(fill_color=#87CEEB)8 h+ e: n( N6 ^, F3 G
此处海洋颜色的天蓝色 ' u0 B/ |' r9 s; @4 v
#87CEEB
8 ~! Q" L- Y) Z/ n8 ~' ?* D" G q 4.2 陆地及湖泊 Basemap.fillcontinents(color=#808000, lake_color=#87CEEB)& U7 B+ h, W* X
陆地为橄榄色
7 R% n; C4 e6 L1 W8 O #808000
8 G1 }; r5 ?4 b# u, b% t" ^3 P 湖泊为天蓝色 : Q% s2 i/ C; I1 E9 \
#87CEEB + U( V; ]4 K* s# [: ^
import numpy as np
; x% d/ E3 ?# X" C# z import matplotlib.pyplot as plt8 d' V& G, k0 |$ t0 W8 w1 o
from mpl_toolkits.basemap import Basemap% j: d: T2 n E0 b) k9 v: z. u
4 \3 ?. U A5 I* x) @( w
map = Basemap()
5 s( |+ @: F; M( X' \8 }$ J map.drawcoastlines(color=r, linewidth=.5)
" p' s: l* `/ o- S9 W map.drawcountries(color=g, linewidth=.25): i' a# u1 P1 `
map.drawstates(color=b, linewidth=.2)2 d- B" B! I3 I% H& B
map.drawparallels(circles=np.linspace(-90, 90, 7),& N7 Q @, z k, U
labels=[1, 0, 0, 0], color=gray)
% E+ S; ?9 J$ Z% b- S# D map.drawmeridians(meridians=np.linspace(-180, 180, 13),& q$ o- \; f( U/ |( M
labels=[0, 0, 0, 1], color=gray)5 G( Z) Y" Z; x, |7 L d0 c
map.fillcontinents(color=#808000, lake_color=#87CEEB)
2 f" B7 q. L, k- k% d5 U3 }% s( H map.drawmapboundary(fill_color=#87CEEB)* B4 a. X: s: [: B9 J5 r
plt.show() 6 I$ W. ]+ H( S2 J
' j7 t) W# O( Y4 L0 g! o0 E- K& u* P* N1 `8 C4 g
) h4 C- o5 i- x3 x
9 G2 ] r9 K; C& [$ M0 Q1 u3 J j( p, b$ X. l3 r/ q- Q4 Y" r
|