plot lines with different x axes on the same MATLAB plot
古いコメントを表示
I am trying to plot two lines with diffenent x axes on the same plot, but matlab kept "avoiding" the first plot and only plot the second one.
(P.S. I checked the y1 and y2, none of them are off the scale of y axis.)
t = tiledlayout(1,1);
ax1 = axes(t);
ax2 = axes(t);
ax1.XAxisLocation = 'bottom';
ax2.XAxisLocation = 'top';
hold(ax1,'on');hold(ax2,'on')
x1 = (1:10);
y1 = sin(x1);
plot(ax1,x1,y1,'r')
hold on
x2 = [11:30];
y2 = cos(x2);
plot(ax2,x2,y2,'b')
The link above are the reference I based on develping this code
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Axes Appearance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



