爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3524|回复: 0

[程序设计] matlab画两种colormap的拼接

[复制链接]

新浪微博达人勋

发表于 2022-11-25 09:25:08 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
matlab画两种colormap的拼接
colormore_1大洋中脊.png

colormore_2大洋中脊.png
colormore_3大洋中脊.png
colormore_4大洋中脊.png clear;clc;close all;
%% 微信公众号:海洋与大气公众号
%% 作者:mapm
%读入地形数据
data_topo='ETOPO2v2g_f4.nc';
x=ncread(data_topo,'x');%[-180  180]
y=ncread(data_topo,'y');%[-90  90]
z=ncread(data_topo,'z');%[-10722   8046]
%将x[-180  180]转换为[0  360]
[row,~]=find(x<=0);
x(row,1)=x(row,1)+360;
x = circshift(x,[length(row)-1 0]);
z= circshift(z,[length(row)-1 0]);
%% % colormap(m_colmap('diverging',30))
figure
set(gcf, 'Color', [1 1 1])%,'position',[910,340,1000,650])
m_proj('miller','lon',[105 114],'lat',[15 22]);hold on
hold on
inter1=2;inter2=2;
m_pcolor(x(1:inter1:end),y(1:inter2:end),z(1:inter1:end,1:inter2:end)')
shading interp
colorbar
% 调用颜色
colormap([ m_colmap('blues',80); m_colmap('gland',48)]);
m_grid('ytick',[15:1:22],'xtick',[100:5:120])
m_coast('color','g','LineWidth',1);
caxis([-5000 3000]);
title('matlab画两种colormap的拼接','fontsize',15)
export_fig(['colormore_',num2str(1),'大洋中脊.png'],'-r300')
%% % colormap(m_colmap('diverging',30))
figure
set(gcf, 'Color', [1 1 1])%,'position',[910,340,1000,650])
m_proj('miller','lon',[105 114],'lat',[15 22]);hold on
hold on
inter1=2;inter2=2;
m_pcolor(x(1:inter1:end),y(1:inter2:end),z(1:inter1:end,1:inter2:end)')
shading interp
colorbar
% 调用颜色
colormap([ m_colmap('blues',80); m_colmap('gland',48)]);
m_grid('ytick',[15:1:22],'xtick',[100:5:120])
caxis([-5000 3000]);
title('matlab画两种colormap的拼接','fontsize',15)
export_fig(['colormore_',num2str(2),'大洋中脊.png'],'-r300')
%% % colormap(m_colmap('diverging',30))
figure
set(gcf, 'Color', [1 1 1])%,'position',[910,340,1000,650])
m_proj('miller','lon',[105 114],'lat',[15 22]);hold on
hold on
inter1=2;inter2=2;
m_pcolor(x(1:inter1:end),y(1:inter2:end),z(1:inter1:end,1:inter2:end)')
shading interp
colorbar
cmap1=colormore_51(80);
cmap2=colormore_52(48);
% 调用颜色
colormap([ flip(cmap1); cmap2]);  
m_grid('ytick',[15:1:22],'xtick',[100:5:120])
caxis([-5000 3000]);
title('matlab画两种colormap的拼接','fontsize',15)
export_fig(['colormore_',num2str(3),'大洋中脊.png'],'-r300')
%% % colormap(m_colmap('diverging',30))
figure
set(gcf, 'Color', [1 1 1])%,'position',[910,340,1000,650])
m_proj('miller','lon',[105 114],'lat',[15 22]);hold on
hold on
inter1=2;inter2=2;
m_pcolor(x(1:inter1:end),y(1:inter2:end),z(1:inter1:end,1:inter2:end)')
shading interp
colorbar
cmap1=colormore_49(80);
cmap2=colormore_50(48);
% 调用颜色
colormap([ flip(cmap1); cmap2]);  
m_grid('ytick',[15:1:22],'xtick',[100:5:120])
caxis([-5000 3000]);
title('matlab画两种colormap的拼接','fontsize',15)
export_fig(['colormore_',num2str(4),'大洋中脊.png'],'-r300')
%% % colormap(m_colmap('diverging',30))
figure
set(gcf, 'Color', [1 1 1])%,'position',[910,340,1000,650])
m_proj('miller','lon',[105 114],'lat',[15 22]);hold on
hold on
inter1=2;inter2=2;
m_pcolor(x(1:inter1:end),y(1:inter2:end),z(1:inter1:end,1:inter2:end)')
shading interp
colorbar
cmap1=colormore_45(80);
cmap2=colormore_46(48);
% 调用颜色
colormap([ flip(cmap1); cmap2]);  
m_grid('ytick',[15:1:22],'xtick',[100:5:120])
caxis([-5000 3000]);
title('matlab画两种colormap的拼接','fontsize',15)
export_fig(['colormore_',num2str(5),'大洋中脊.png'],'-r300')
%% % colormap(m_colmap('diverging',30))
figure
set(gcf, 'Color', [1 1 1])%,'position',[910,340,1000,650])
m_proj('miller','lon',[105 114],'lat',[15 22]);hold on
hold on
inter1=2;inter2=2;
m_pcolor(x(1:inter1:end),y(1:inter2:end),z(1:inter1:end,1:inter2:end)')
shading interp
colorbar
cmap1=colormore_35(80);
cmap2=colormore_9(48);
% 调用颜色
colormap([ flip(cmap1); cmap2]);  
m_grid('ytick',[15:1:22],'xtick',[100:5:120])
caxis([-5000 3000]);
title('matlab画两种colormap的拼接','fontsize',15)
export_fig(['colormore_',num2str(6),'大洋中脊.png'],'-r300')
%% % colormap(m_colmap('diverging',30))
figure
set(gcf, 'Color', [1 1 1])%,'position',[910,340,1000,650])
m_proj('miller','lon',[105 114],'lat',[15 22]);hold on
hold on
inter1=2;inter2=2;
m_pcolor(x(1:inter1:end),y(1:inter2:end),z(1:inter1:end,1:inter2:end)')
shading interp
colorbar
cmap1=colormore_5(80);
cmap2=colormore_6(48);
% 调用颜色
colormap([ flip(cmap1); cmap2]);  
m_grid('ytick',[15:1:22],'xtick',[100:5:120])
caxis([-5000 3000]);
title('matlab画两种colormap的拼接','fontsize',15)
export_fig(['colormore_',num2str(7),'大洋中脊.png'],'-r300')




密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表