fig = figure('Color','white','PaperUnits','centimeters','PaperSize',[16 14],'PaperPosition',[0,0,16,14],'Visible','on');
[Lat Lon]=CdtGrid(0.5);
m_proj('miller','lon',[Lon(1,1) Lon(1,end)],'lat',[Lat(end,1) Lat(1,1)]); % 选择投影地图与图片经纬度范围
m_etopo2('contourf',[-7000:1000:-1000 -500 -200 0 ],'edgecolor','none'); % 绘制水深数据
% m_gshhs('lc','patch', [.7 .7 .7], 'edgecolor','none'); % 绘制海岸线
m_grid('linest','none','tickdir','out','box','fancy','fontsize',16); % 绘制经纬度网格
colormap(m_colmap('blues', 20)); % 设置水深色标
Per=m_plot(boux,bouy,'k');
hold on
FaceColor_List=cmocean('tempo');
CL=FaceColor_List(1:5:256,:);
CL=CL(1:44,:);
im=m_patch(boux,bouy,[1 1 1]);
for k =1:44
im(k).FaceColor=[CL(k,:)];
im(k).FaceAlpha=0.5;
end
% 另一种逐一改颜色的方法
for k =1:44
mapshow(GPP_Veg_Cover(k),'FaceColor',[CL(k,:)],'facealpha',0.5, 'EdgeColor','k');%把地图画出来
end
# 感谢 https://zhuanlan.zhihu.com/p/260434804 怎么使用几行Matlab代码绘制地图?一文的启发
![在这里插入图片描述](https://img-blog.csdnimg.cn/57f1d33f123b4f92a790bdd936bf750f.png)
Matlab逐一更改shpfile 区域颜色
最新推荐文章于 2024-08-23 15:17:59 发布