Does anyone know why the second plot doesn't work?

조회 수: 3 (최근 30일)
Pul
Pul 2021년 7월 25일
댓글: Star Strider 2021년 7월 26일
Hello everyone,
doesn anyone know why in the third plot don't appear the data present in the previous plot?
In the third plot should appear the data present in the first and second plot.
Thank you!

채택된 답변

Star Strider
Star Strider 2021년 7월 25일
Yes!
In line #44, there is a
hold off
call, although no new figure call, so the subsequent plot overplots the existing plot. The second plot is the only plot that displays because of that.
I am not absolutely certain, however this may be what you want:
%DA PLOTTARE
LD = load('Pul MODESTAMMEQ.mat');
MODESTAMMEQ = LD.MODESTAMMEQ;
dv = regexp(MODESTAMMEQ.Jan1989, '\d*\-\w*\-\d*','match');
MODESTAMMEQ.Var1 = datetime([dv{:}], 'InputFormat',"dd-MMM-yyyy").';
x = MODESTAMMEQ.Var1;
y = MODESTAMMEQ.Var2*10*0.35;
figure
plot(x, y)
grid
xlabel('Time');
ylabel('Height(mm)');
title('MODESTA Mmeq')
%ADDING--> FIRST PLOT
% load('MODESTA_MMEQ_STAKES');
load('Pul MODESTA_PALINE_DELTA');
errorbar(x,MODESTAMMEQ.Var5(:,1),MODESTAMMEQ.Var4(:,1),'.r','MarkerSize',6)
hold on
plot(x,[y, MODESTAMMEQ.Var5(:,1)]);
hold on
xlabel('Time');
ylabel('Height(mm)');
title('Modesta AWS and Stakes')
xlabel('Time');
ylabel('Height(mm)');
title('Modesta AWS and Stakes')
%2ND PLOT
load('Pul MODESTA_PALINE_DELTA');
errorbar(x(5432:6513,1),MODESTAMMEQ.Var5(5432:6513,1),MODESTAMMEQ.Var4(5432:6513,1),'.r','MarkerSize',6);
errorbar(x(7639:10569,1),MODESTAMMEQ.Var5(7639:10569,1),MODESTAMMEQ.Var4(7639:10569,1),'.b','MarkerSize',6);
errorbar(x(10570:11265,1),MODESTAMMEQ.Var5(10570:11265,1),MODESTAMMEQ.Var4(10570:11265,1),'.m','MarkerSize',6);
% plot(x,[y, MODESTAMMEQ.Var5(:,1)],'g')
plot(MODESTAMMEQ.Var1(:,1),y);
hold off
xlabel('Time');
ylabel('Height(mm)');
title('Modesta AWS and Stakes')
% plot(x,[y, MODESTAMMEQ.Var5(:,1)],'g');
% xlabel('Time');
% ylabel('Height(cm)');
% title('Modesta AWS and Stakes');
load('Pul DATI_MAR_ANNUALI');
load('Pul DATA_ECM');
%MODESTA(MP) --> THIRD PLOT
% plot(T.Year(:,1),[NEW, T.Var4(:,1) T.Var5(:,1)],'g');
figure
hold on
plot(MODESTAMMEQ.Var1(:,1),[y, MODESTAMMEQ.Var5(:,1)], 'g' , 'DisplayName','AWS')
plot(datetime(DATIMARannuali.Year,1,1), DATIMARannuali.SMB_priestleymm,'--co', 'MarkerEdgeColor','k','MarkerFaceColor','c', 'DisplayName','ECMWF');
plot(datetime(DATIECMWFannuali.Year,1,1), DATIECMWFannuali.SMB_priestleymm,'m-*', 'DisplayName','MAR');
hold off
legend('Location','best')
% figure
If that does not solve the problem, please explain in more detail what you want plotted in specific figures.
.
  댓글 수: 2
Pul
Pul 2021년 7월 26일
Yes, you solved my problem.
Thank you!
Star Strider
Star Strider 2021년 7월 26일
Thank you!
As always, my pleasure!
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by