how to normalize or plot in the same scale in 2 sided graph ?

3 ビュー (過去 30 日間)
Akim Mahmud
Akim Mahmud 2018 年 5 月 1 日
回答済み: lokender Rawat 2018 年 5 月 7 日
Hi,
I have surface water and air temp data aganist time in the attached plot. How do I plot the both temp data in the same y axis range, for example from 30 F to 80 F ? Please help.

回答 (1 件)

lokender Rawat
lokender Rawat 2018 年 5 月 7 日
Since you are able to generate the plot, the only thing is to have it scaled to same values on both sides of y-axis. You can use the 'ylim' command after the 'plot' command in your code. Below is a sample code where you can see the y-axis being scaled to same values on both the vertical axes.
x = linspace(0,10,50);
y1 = sin(x);
figure
yyaxis left
plot(x,y1)
ylim([0 1]);
%title('Combine Plots')
hold on
y2 = sin(x/2).^x;
plot(x,y2)
hold off
You can see the difference in the figure once you comment the 'ylim([0 1])' command in the above sample code. Read more on ylim command using below link:

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by