当前位置: 首页 > 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

http://www.xdnf.cn/news/60733.html

相关文章:

  • 基于Java的不固定长度字符集在指定宽度和自适应模型下图片绘制生成实战
  • Linux学习笔记协议篇(六):SPI FLASH设备驱动
  • 华为VRP系统知识总结及案例试题
  • 下载pycharm遇到的问题及解决方法
  • 深度学习3.5图像分类数据集
  • elastic/go-elasticsearch与olivere/elastic
  • 乐家桌面安卓版2025下载-乐家桌面软件纯净版安装分享码大全
  • 【scikit-learn基础】--『监督学习』之 均值聚类
  • GPT,Genini, Claude Llama, DeepSeek,Qwen,Grok,选对LLM大模型真的可以事半功倍!
  • 发布事件和Insert数据库先后顺序
  • GeoJSON 格式详解与使用指南
  • Macbook IntelliJ IDEA终端无法运行mvn命令
  • 【2025面试Java常问八股之redis】zset数据结构的实现,跳表和B+树的对比
  • 1.Vue3 - 创建Vue3工程
  • JavaEE--2.多线程
  • RHCE 练习二:通过 ssh 实现两台主机免密登录以及 nginx 服务通过多 IP 区分多网站
  • 【基础算法】二分算法详解
  • 科大讯飞Q1营收46.6亿同比增长27.7%,扣非净利同比增长48.3%
  • [c语言日寄]免费文档生成器——Doxygen在c语言程序中的使用
  • uniapp-商城-31-shop页面中的 我的订单
  • 【大语言模型DeepSeek+ChatGPT+python】最新AI-Python机器学习与深度学习技术在植被参数反演中的核心技术应用
  • idea使用docker插件一键部署项目
  • Time to event :Kaplan-Meier曲线、Log Rank检验与Shiny R
  • Oracle EBS R12.2 安装 -- Step by Step
  • 利用Qt创建一个模拟问答系统
  • Oracle expdp的 EXCLUDE 参数详解
  • 【橘子大模型】Tools/Function call
  • 【MySQL】库的操作
  • MCU开发学习记录10 - 高级定时器学习与实践(HAL库)—PWM互补输出、死区控制、刹车控制 - STM32CubeMX
  • 邀请函 | 「软件定义汽车 同星定义软件」 TOSUN用户日2025·杭州站