Does anyone know why the second plot doesn't work?
4 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Star Strider
on 25 Jul 2021
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 Comments
More Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!