【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

相关推荐
你不是我我7 小时前
【Java 开发日记】SQL 语句左连接右连接内连接如何使用,区别是什么?
java·javascript·数据库
ghie90907 小时前
C#语言中使用“using“关键字的介绍
开发语言·c#
JELEE.7 小时前
Django中如何重写save()方法
数据库·django
SuperSpinach7 小时前
mysql 报错Authentication method ‘caching_sha2_password‘ is not supported.
数据库·mysql
七夜zippoe7 小时前
Java性能调优工具篇:JMH基准测试与Profiler(JProfiler/Async-Profiler)使用指南
java·开发语言·jprofiler·jmh·async-profiler
R.lin7 小时前
MySQL 性能优化最佳实践
数据库·mysql·性能优化
北i7 小时前
TiDB 关联子查询去关联优化实战案例与原理深度解析
java·数据库·sql·tidb
清风6666667 小时前
基于单片机的智慧校园自动打铃系统设计
数据库·单片机·嵌入式硬件·毕业设计·课程设计·期末大作业
小龙报8 小时前
《嵌入式成长系列之51单片机 --- Keil5创建工程》
c语言·开发语言·c++·单片机·嵌入式硬件·51单片机·学习方法
无限进步_8 小时前
【C语言】贪吃蛇游戏设计思路深度解析:从零开始理解每个模块
c语言·开发语言·c++·git·游戏·github·visual studio