将磁异常的colorbar改为对数坐标import pygmt 创建一个地图投影 fig = pygmt.Figure() 设置地图投影的范围和边界 region = [112, 120, 10, 20] projection = 'M10c' fig.basemap(region=region, projection='M10c', frame=True) 绘制海底地形数据 fig.grdimage("@earth_relief_03m", region=region, cmap='geo') 添加海岸线 fig.coast(shorelines=True) fig.grdcontour("@earth_relief_03m", region=region, interval=1000, pen='1p,black') 添加colorbar fig.colorbar(cmap='geo', frame=['x+l"Elevation"', 'y+lm']) fig.grdimage("@earth_mag", region=region, projection=projection, cmap='jet', transparency=60) 创建自定义的colorbar cmap = pygmt.makecpt(cmap='jet', series=[-200, 200]) # 设置磁异常的范围 fig.colorbar(frame='af+l"Magnetic Anomaly"', cmap=cmap, position='JMR+o0c/0c+w5c/0.5c') 显示地图 fig.show()
时间: 2024-02-05 14:02:41 浏览: 144
import pygmt
# 创建一个地图投影
fig = pygmt.Figure()
# 设置地图投影的范围和边界
region = [112, 120, 10, 20]
projection = 'M10c'
fig.basemap(region=region, projection='M10c', frame=True)
# 绘制海底地形数据
fig.grdimage("@earth_relief_03m", region=region, cmap='geo')
# 添加海岸线
fig.coast(shorelines=True)
# 绘制等高线
fig.grdcontour("@earth_relief_03m", region=region, interval=1000, pen='1p,black')
# 添加colorbar
fig.colorbar(cmap='geo', frame=['x+l"Elevation"', 'y+lm'])
# 绘制磁异常数据
fig.grdimage("@earth_mag", region=region, projection=projection, cmap='jet', transparency=60)
# 创建自定义的colorbar
cmap = pygmt.makecpt(cmap='jet', series=[-200, 200]) # 设置磁异常的范围
fig.colorbar(frame='af+l"Magnetic Anomaly"', cmap=cmap, position='JMR+o0c/0c+w5c/0.5c', scale='log')
# 显示地图
fig.show()
阅读全文