# Matlab m_map一张地图上使用用多个colormap以及patch精细岸线数据去除河流

1. 两幅图拼接成一个colorbar，实际上就是拼接成一个colormap，实现起来太麻烦了

2. 第二种利用一个大佬John Iversen写的FreezeColors程序包，上传到了matlab官方，以下是一个例子

https://ww2.mathworks.cn/matlabcentral/fileexchange/7943-freezecolors-unfreezecolors?requestedDomain=zh

figure,hold on

m_proj('Miller','lon',[lonlim1 lonlim2],'lat',[latlim1 latlim2])

m_contourf(x,y,z',[0:100:8000],'linestyle','none','levelstep',.1);% 陆地高程

m_grid('box','fancy','xtick',[0:5:180],'ytick',[0:5:90],'linestyle','none',...

'linewidth',0.5,'backcolor','none');

colormap([m_colmap('gland',80)]);

caxis([0 8000])

colorbar

figure,hold on

m_proj('Miller','lon',[lonlim1 lonlim2],'lat',[latlim1 latlim2])

m_contourf(lon,lat,sst','linestyle','none','levelstep',.1);% 海表温度

m_grid('box','fancy','xtick',[0:5:180],'ytick',[0:5:90],'linestyle','none',...

'linewidth',0.5,'backcolor','none');

colormap('jet');

caxis([28 31])

colorbar

figure,hold on

m_proj('Miller','lon',[lonlim1 lonlim2],'lat',[latlim1 latlim2])

pc = m_pcolor(x,y,z');% 陆地高程

set(pc,'linestyle','none');

m_grid('box','fancy','xtick',[0:5:180],'ytick',[0:5:90],'linestyle','none',...

'linewidth',0.5,'backcolor','none');

colormap([m_colmap('gland',80)]);freezeColors

caxis([0 8000])

% m_contourf(lon,lat,sst','linestyle','none','levelstep',.1);

pc = m_pcolor(lon,lat,sst');% 海表温度

set(pc,'linestyle','none');

colormap('jet');

caxis([28 31])

colorbar

figure,hold on

m_proj('Miller','lon',[lonlim1 lonlim2],'lat',[latlim1 latlim2])

% m_gshhs_l('patch',[0.7 0.7 0.7],'Edgecolor','none');% 只加这行会有河流对应左图

m_gshhs('lc1','patch',[0.7 0.7 0.7],'Edgecolor','k');% 只加这行没有河流对应右图

m_grid('box','fancy','xtick',[0:10:180],'ytick',[0:10:90],'linestyle','none',...

'linewidth',0.5,'backcolor','none');

m_contourf(lon,lat,sst','linestyle','none','levelstep',.1);

colormap('jet');

caxis([28 31])

colorbar

http://blog.sciencenet.cn/blog-3386114-1209501.html

## 全部精选博文导读

GMT+8, 2020-4-2 03:11