问题:在利用GMTGMT绘制地图有时需要高亮研究区域内的地形起伏。就像下图(Yi et al., 2023):

通常我们需要提供研究区域内的边界文件,比如下列代码实现了如何将青藏高原区域高亮:

#!/usr/bin/env bash
# Chistrong Wen
# Uni stuttgart
# 2024-10-16
gmt begin csdn_heightlight_country png,pdf E600
# 绘制底图
gmt set FORMAT_GEO_MAP = ddd:mm:ssF
gmt set MAP_FRAME_TYPE = fancy
gmt set MAP_FRAME_PEN = 2p,black
gmt set MAP_TICK_PEN = 0.5p,black
gmt set FONT_ANNOT_PRIMARY = 9p,Helvetica,black
gmt set FONT_ANNOT_SECONDARY = 12p,Times-Roman,black
gmt set MAP_TICK_LENGTH = 1.5p
gmt set LABEL_FONT = 12p
gmt set FONT_LABEL = 12p
gmt set LABEL_FONT_SIZE = 12p
gmt set ANNOT_FONT_SIZE_PRIMARY = 12p
gmt set MAP_FRAME_WIDTH = 2p 
gmt set FRAM_WIDTH = 1c
gmt set MAP_ANNOT_OFFSET_PRIMARY = 0.15c
gmt set MAP_TICK_LENGTH_PRIMARY = 0.15c
gmt set FORMAT_ANNOT_PRIMARY = 2p,Times-Roman,black
gmt basemap -R60/120/15/50 -JM12c -BWSNE -Bxa10f10 -Bya10f10 -Xc -Y18c
gmt grdimage @earth_relief_01m -Cbest_dem1.cpt -I+m-0.8
# important code
gmt clip Tibet_boundary.txt
gmt grdimage @earth_relief_01m -Cbest_dem1.cpt -I+d
gmt clip -C
gmt plot Tibet_boundary.txt -W1p,red
# 
gmt coast -A50000 -W0.2p,black
gmt plot MajorRivers.gmt -W0.5p,blue
gmt set MAP_FRAME_PEN = 0.5p,black
gmt basemap -R-180/180/-90/90 -JG90/35/3c -Bf10a10 -Bg30 -BWESN -X0c -Y0c
gmt makecpt -Cdelta -T-2/2/0.05
gmt grdimage m11.grd -C
gmt coast -A50000 -W0.1p,black -Bg30 
gmt plot -W1p,red<<EOF
60 15
60 50
120 50
120 15
60 15
EOF
gmt end 

显示结果

而下列代码给出了如何将国家区域(印度)高亮显示:

#!/usr/bin/env bash
# Chistrong Wen
# Uni stuttgart
# 2024-10-16

gmt begin csdn_heightlight_country png,pdf E600

# 绘制底图

gmt set FORMAT_GEO_MAP = ddd:mm:ssF

gmt set MAP_FRAME_TYPE = fancy

gmt set MAP_FRAME_PEN = 2p,black

gmt set MAP_TICK_PEN = 0.5p,black

gmt set FONT_ANNOT_PRIMARY = 9p,Helvetica,black

gmt set FONT_ANNOT_SECONDARY = 12p,Times-Roman,black

gmt set MAP_TICK_LENGTH = 1.5p

gmt set LABEL_FONT = 12p

gmt set FONT_LABEL = 12p

gmt set LABEL_FONT_SIZE = 12p

gmt set ANNOT_FONT_SIZE_PRIMARY = 12p

gmt set MAP_FRAME_WIDTH = 2p

gmt set FRAM_WIDTH = 1c

gmt set MAP_ANNOT_OFFSET_PRIMARY = 0.15c

gmt set MAP_TICK_LENGTH_PRIMARY = 0.15c

gmt set FORMAT_ANNOT_PRIMARY = 2p,Times-Roman,black

gmt basemap -R60/120/15/50 -JM12c -BWSNE -Bxa10f10 -Bya10f10 -Xc -Y18c

gmt grdimage @earth_relief_01m -Cbest_dem1.cpt -I+m-0.5

# important code

gmt coast -EIndia+c

gmt grdimage @earth_relief_01m -Cbest_dem1.cpt -I+d

gmt clip -C

#

gmt coast -A50000 -W0.2p,black

gmt plot MajorRivers.gmt -W0.5p,blue

gmt set MAP_FRAME_PEN = 0.5p,black

gmt basemap -R-180/180/-90/90 -JG90/35/3c -Bf10a10 -Bg30 -BWESN -X0c -Y0c

gmt makecpt -Cdelta -T-2/2/0.05

gmt grdimage m11.grd -C

gmt coast -A50000 -W0.1p,black -Bg30

gmt plot -W1p,red<<EOF

60 15

60 50

120 50

120 15

60 15

EOF

gmt end

显示结果:

参考资料:

(53) Building subplots and using per-country shading — GMT 6.5.0 documentation

️欢迎点赞收藏️

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部