这张图放大,因为这里是不会画的地方,time.depth这个坐标轴如何画?因此,我重点重复这里;另外,由于实测数据的不方便透露,我自己造个数据;我复现唯一不确定深度和时间之间的比例,其他还正常。.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;clc;close all;
% 时间数据
time = 0:1000;
% 深度数据;
depth1=nan(1,94);
depth2 = 95:1000;
depth = [depth1 depth2];
% 由于没有原图的数据,构造一个温度随深度变化的数据
%
temp = randi(6,1000,1);
temp(1:94)=nan;% 深度前94米没数据,从图中看到;
temp = temp-1;
temp = movmean(temp,10);
右侧深度:刻度显示0:50中间10条短线条,意思你的间隔为五 if mod(i-1,50)==0% 深度是50的倍数放长线
line([ 8 8.25],[i i],'color','k')
text(8.26,i,num2str(i-1))
hold on
else %放短线
hold on
line([8 8.1],[i i],'color','k')
end
.rtcContent { padding: 30px; } .lineNode {font-size: 12pt; font-family: "Times New Roman", Menlo, Monaco, Consolas, "Courier New", monospace; font-style: normal; font-weight: normal; }
%% 画图
close all
figure
set(gcf,'position',[50 50 850 1200],'color','w')
plot(temp,depth,'k','linewidth',1.5)
% set(gca,'ticklength',[0.05 0.025]);% 刻度长度(大刻度与小刻度长度)
% set(gca,'tickdir','out');%刻度放到外围
set(gca,'XAxisLocation','top');%刻度放到外围
set(gca,'xtick',[0:5],'xticklabel',[0:5],'ytick',[],'yticklabel',[],'YAxisLocation','right','YDir','reverse','LineWidth',2)
xlim([-2 10])
ylim([-250 1000])
hold on
line([6 6],[-250 1000],'color','k','linewidth',2)
% 右侧 depth
line([8 8],[-250 1000],'color','k','linewidth',2)
hold on%
for i = 1:5:1000% 刻度显示0:50中间10条短线条,意思你的间隔为五
if i<=95
continue
else
if mod(i-1,50)==0% 时间是50的倍数放长线
line([ 8 8.25],[i i],'color','k')
text(8.26,i,num2str(i-1))
hold on
else %放短线
hold on
line([8 8.1],[i i],'color','k')
end
end
end
hold on
line([8 8.25],[96 96],'color','k')
text(8.26,96,num2str(96-1))
hold on %左侧时间 time
for i =1:5:1250% 刻度显示0:50中间10条短线条,意思你的间隔为五
if mod(i-1,50)==0% 时间是50的倍数放长线
line([ 7.75 8],[i-251 i-251],'color','k')
text(7.35,i-250,num2str(i-1))
hold on
else %放短线
hold on
line([7.9 8],[i-251 i-251],'color','k')
end
end
% text
text(7.5,-285,'Time/depth')
text(2.5,-205,'Temp')
export_fig('temp_profile.jpg','-r300')
.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;clc;close all;
% 时间数据
time = 0:1000;
% 深度数据;
depth1=nan(1,94);
depth2 = 95:1000;
depth = [depth1 depth2];
% 由于没有原图的数据,构造一个温度随深度变化的数据
%
temp = randi(6,1000,1);
temp(1:94)=nan;% 深度前94米没数据,从图中看到;
temp = temp-1;
temp = movmean(temp,10);
%% 画图
close all
figure
set(gcf,'position',[50 50 850 1200],'color','w')
plot(temp,depth,'k','linewidth',1.5)
% set(gca,'ticklength',[0.05 0.025]);% 刻度长度(大刻度与小刻度长度)
% set(gca,'tickdir','out');%刻度放到外围
set(gca,'XAxisLocation','top');%刻度放到外围
set(gca,'xtick',[0:5],'xticklabel',[0:5],'ytick',[],'yticklabel',[],'YAxisLocation','right','YDir','reverse','LineWidth',2)
xlim([-2 10])
ylim([-250 1000])
hold on
line([6 6],[-250 1000],'color','k','linewidth',2)
% 右侧 depth
line([8 8],[-250 1000],'color','k','linewidth',2)
hold on%
for i = 1:5:1000% 刻度显示0:50中间10条短线条,意思你的间隔为五
if i<=95
continue
else
if mod(i-1,50)==0% 时间是50的倍数放长线
line([ 8 8.25],[i i],'color','k')
text(8.26,i,num2str(i-1))
hold on
else %放短线
hold on
line([8 8.1],[i i],'color','k')
end
end
end
hold on
line([8 8.25],[96 96],'color','k')
text(8.26,96,num2str(96-1))
hold on %左侧时间 time
for i =1:5:1250% 刻度显示0:50中间10条短线条,意思你的间隔为五
if mod(i-1,50)==0% 时间是50的倍数放长线
line([ 7.75 8],[i-251 i-251],'color','k')
text(7.35,i-250,num2str(i-1))
hold on
else %放短线
hold on
line([7.9 8],[i-251 i-251],'color','k')
end
end
% text
text(7.5,-285,'Time/depth')
text(2.5,-205,'Temp')
export_fig('temp_profile.jpg','-r300')