当前位置: 首页 > news >正文

【matlab】地图上的小图

【matlab】地图上的小图

在这里插入图片描述

.rtcContent { padding: 30px; } .lineNode {font-size: 12pt; font-family: "Times New Roman", Menlo, Monaco, Consolas, "Courier New", monospace; font-style: normal; font-weight: normal; }
clear;close all;clc;
load nearshore_province.mat
table_tidalflat = readtable('China_tidalflat.csv','VariableNamingRule','preserve');
tidalflat = table2array(table_tidalflat);
load width_year.mat
load tsm_year.mat
nanloc1=find(isnan(tidalflat(:,6)));
tidalflat(nanloc1,:)=[];
tsm_10(nanloc1,:)=[];
tidalflat(:,9:10) = tidalflat(:,9:10)/100;
slope_bar=tidalflat;
%%
width_year=[width_2002 width_2005 width_2008 width_2011 width_2016];
width_mean=median(width_year,1,'omitnan');
x=2003:3:2015;
x1=700;
y1=700;
figure('Position', [10, 20, x1, y1],'color','w')
%%
[~,TF]=rmoutliers(tidalflat(:,10),'median');
rm=find(TF==1);
tidalflat(rm,:)=[];
[~,TF2]=rmoutliers(tidalflat(:,9),'median');
rm2=find(TF2==1);
tidalflat(rm2,:)=[];
[swh_uni,aa]=unique(tidalflat(:,7),'stable');
tf_unique=[];
for i=1:length(aa)loc=find(tidalflat(:,7)==swh_uni(i));slope_loc=tidalflat(loc,:);slope_u=mean(slope_loc,1);tf_unique=[tf_unique;slope_u];
end
tf_unique(isnan(tf_unique(:,10)),:)=[];
t1=length(find(tf_unique(:,10)<-0.025))/length(find(~isnan(tf_unique(:,10))));
t2=length(find(tf_unique(:,9)<0))/length(tf_unique(:,1));
ratio = sum(tf_unique(:,10).*tf_unique(:,9)>0)/sum(~isnan(tf_unique(:,10).*tf_unique(:,9)));
slope_diff = tf_unique(tf_unique(:,10).*tf_unique(:,9)>0,:);
World =shaperead('landareas.shp','UseGeoCoords',true);
ChinaL=shaperead('china1.shp');
ChinaP=shaperead('china2.shp');
hold on
geoshow(World,'facecolor',[.99 .99 .99],'edgecolor',[.3 .3 .3])
mapshow(ChinaL,'color',[.5 .5 .5])
mapshow(ChinaP(yanhai,:),'facecolor',[.7 .7 .7],'edgecolor',[.5 .5 .5])
mapshow(ChinaP(~yanhai,:),'facecolor',[.9 .9 .9],'edgecolor',[.9 .9 .9])
x = tf_unique(:,2); 
y = tf_unique(:,3); 
c = tf_unique(:,10); 
alpha = abs(c)./max(abs(c));
cmap = [2, 48, 74;19,103,131;33,158,188;144,201,231;233, 241, 244;251, ...227, 213;246,178,147;220,109,87;183,34,48; 109, 1, 31]/256;
n = size(cmap, 1);  
xq = linspace(1, n, 256);
cmap_smooth = interp1(1:n, cmap, xq, 'linear');
colormap(cmap_smooth);
scatter(x,y,7,c,'filled')%12
xlabel('Longitude (deg)','FontSize',8,'fontweight','bold');
ylabel('Latitude (deg)','FontSize',8,'fontweight','bold');
xticks([110 120])
xticklabels({'110°E','120°E'})
yticks([20 30 40])
yticklabels({'20°N','30°N','40°N'})
clim([-max(abs(c)), max(abs(c))]);
xlim([104 128])
ylim([17.5 41.5])
ax=gca;
ax.FontName = 'times new roman';
ax.FontSize = 8;
ax.TickLength = [0.01, 0.01];
ax.LineWidth = 1.5;
ax.XRuler.TickDirection = 'out';
ax.YRuler.TickDirection = 'out';
ax.Layer = 'top';
box on
% color bar site
h = colorbar('Location', 'south', 'Position', [.2, .5, 150/x1, 15/y1]);
ylabel(h,'Trend in annual Tidal flat width (%/year)','fontsize',8,'fontname','times new roman') 
set(h,'fontsize',8,'fontname','times new roman');
set(h,'YTickLabel',num2str(get(h,'YTick')'*100,'%g%%'))
% small figure 
xq1 = linspace(1, n, 15);
cmap_smooth1 = interp1(1:n, cmap, xq1, 'linear');
h1=axes('position',[.2, .55, 150/x1, 150/y1]);	% set the size of the small figure
edges=linspace(-0.07,0.07,15);
for i=1:length(edges)-1
histogram(tf_unique(:,10),edges(i:i+1), 'Normalization', 'probability','FaceColor',cmap_smooth1(i,:));
hold on
end
mu = mean(tf_unique(:,10));
sigma = std(tf_unique(:,10));
xx = min(tf_unique(:,10)):0.01:max(tf_unique(:,10));
yy = normpdf(xx, mu, sigma);
ax = gca;
counts = ax.YTick;
percentages = counts * 100;
ax.YTickLabel = string(percentages);
xlim([-0.08 0.08])
xticks([-0.05 0 0.05])
set(gca,'XTickLabel',num2str(get(gca,'XTick')'*100,'%g%%'))
ylabel('Frequency (%)','fontname','times new roman')
set(gca,'color','none');
box off
print('-djpeg','-r300','fig3.jpg')

参考文献:
Liu, S., Hu, Z., Grandjean, T.J.et al.Dynamics and drivers of tidal flat morphology in China.Nat Commun16, 2153 (2025). https://doi.org/10.1038/s41467-025-57525-y

相关文章:

  • 解决方案:远程shell连不上Ubuntu服务器
  • 阿里云人工智能大模型MCP协议
  • 薪技术|0到1学会性能测试第19课-参数化技术之导入数据
  • 正计数为倒计数(STC89C52单片机)
  • 实践项目开发-hbmV4V20250407-React+Taro多端项目依赖冲突解决方案
  • ESP8266_ESP32 Smartconfig一键配网功能
  • python全栈-flask
  • 【CUDA 】第5章 共享内存和常量内存——5.2 共享内存的数据分布(2)
  • 七、小白如何用Pygame制作一款跑酷类游戏(碰撞检测)
  • Python第二周作业
  • 企业常见漏洞类型
  • 赛灵思Xilinx FPGa XCKU15P‑2FFVA1156I AMD Kintex UltraScale+
  • 蓝牙WiFi模组rtl8821cs在Android14调
  • 【EasyPan】application.properties配置文件解析
  • Coze平台​ 创建AI智能体的详细步骤指南
  • 齐次坐标系下的变换矩阵
  • PCB 射频天线设计和版图创建技巧
  • 从洗衣房到国学课堂:海信冰箱发起跨越千里的山区助学行动
  • 通过规范化模型自训练增强医学图像分割中的无监督域自适应|文献速递-深度学习医疗AI最新文献
  • Spring Boot+Mybatis设置sql日志打印
  • 福建浯屿岛垃圾排海追踪:堆存已清理,当地称今后会日产日清日运
  • 为什么要研制大型水陆两栖飞机?AG600总设计师给出答案
  • 中签不易,住宿更难,马拉松赛事期间酒店涨价难题如何解决?
  • 重庆网红景点“莲花茶摊”被市民投诉,官方:采纳意见,整改!
  • 经济日报经世言:不断开创中马关系发展新局面
  • 俄总统新闻秘书:乌克兰问题谈判相当艰难