How can I plot multiple graphs on the same figure using plotxx?

8 ビュー (過去 30 日間)
Larissa Perez
Larissa Perez 2016 年 11 月 17 日
コメント済み: Larissa Perez 2016 年 11 月 17 日
Hey guys!
I'm new to Matlab and have a question. I basically need to plot several profiles of 2 different variables on the same figure. So I downloaded plotxx, which worked perfectly to plot one profile of each. But when I try to use hold on, and add more plots, it doesn't work as well. Can someone give me some help? That's what I have been trying:
[ax,t1,s1] = plotxx (x1, y1, x2,y2, xlabels, ylabels)
axx = ax(1);
set(ax(1),'YDir','reverse','YLim', [0 200], 'xlim', [15 25])
set(ax(2),'YDir','reverse','YLim', [0 200], 'YTickLabel',' ','xlim',[-50 50])
hold on
plotxx (x3, y3,x4,y4, xlabels, ylabels)
in which, all the x's and y's should have the same axis.
  2 件のコメント
Geoff Hayes
Geoff Hayes 2016 年 11 月 17 日
Larissa - do your original plots "disappear" because of the call to plotxx or to changing the limits on the axes?
Larissa Perez
Larissa Perez 2016 年 11 月 17 日
No, but the numbers and labels on the axis appear on top of each other, in the wrong places.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 11 月 17 日
[ax,t1,s1] = plotxx(x1, y1, x2,y2, xlabels, ylabels)
set( ax(1),'YDir','reverse','YLim', [0 200], 'xlim', [15 25])
set( ax(2),'YDir','reverse','YLim', [0 200], 'YTickLabel',' ','xlim',[-50 50])
hold( ax(1), 'on')
plot( ax(1), x3, y3);
hold( ax(1), 'off');
hold( ax(2), 'on')
plot( ax(2), x4, y4);
hold( ax(2), 'off')
  1 件のコメント
Larissa Perez
Larissa Perez 2016 年 11 月 17 日
Thank you so much, Walter! Worked perfectly!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by