필터 지우기
필터 지우기

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.

조회 수: 4 (최근 30일)
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개)

Navid J
Navid J 2017년 5월 18일
편집: Navid J 2017년 5월 18일
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)')

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by