How to plot a graph in MATLAB - Rainfall on secondary axis (inverted i.e, upside down), Simulated results in line and Observed in dotted on primary axis.
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have rainfall data. Simulated soil moisture and observed soil moisture. I want to plot it in MATLAB, with rainfall data on secondary Y-axis (Inverted), Simulated and Observed soil data on primary axis. X axis will show number of days, while primary and secondary axis will show Soil moisture and rainfall depth.
1 Kommentar
Antworten (1)
Navid J
am 18 Mai 2017
Bearbeitet: Navid J
am 18 Mai 2017
figure1 = figure('position', [0, 0, plotwidth, plotheight]);
ax1 = axes('Parent',figure1);
hold(ax1,'on');
plot(date,TS1,'color',[0 0 0]);
plot(date,TS2,'color',[0 0 1]);
ylim([0 0.7])
xlim([datenum('2016/05/1') datenum('2016/10/1')])
xlabel('Date')
ylabel('Soil Moisture (cm^3/cm^3)')
legend('TS 1', 'TS 2','Location', 'Northeast');
datetick('x','mmm','keeplimits')
ax2 = axes('Position',ax1_pos,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
set(ax2,'Ydir','reverse')
line(x,p,'Parent',ax2,'color',[1 1 1])
set(ax2,'Color','none','XAxisLocation','top','XTickLabel',...
{'','','','','',''},'YAxisLocation','right');
ylim([0 90])
xlim([datenum('2016/05/1') datenum('2016/10/1')])
xlabel('')
ylabel('Rainfall (mm)')
1 Kommentar
Siehe auch
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!