フィルターのクリア

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 日間)
shifu
shifu 2015 年 4 月 16 日
コメント済み: Srishti Gaur 2018 年 9 月 4 日
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 Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by