Plotting using multiple x-axes and y-axes.

3 ビュー (過去 30 日間)
Aftab Ahmed Khan
Aftab Ahmed Khan 2015 年 2 月 26 日
コメント済み: Aftab Ahmed Khan 2015 年 2 月 27 日
Hi everyone, i am plotting two curves on a same figure, since the x-axis scale is different for both of them, so i am using multiple x-axes and y-axes option. I am having a problem with the axes command which gives me the following error message. *Error using axes Value must be a 4 element vector.
Only the first graph is plotting. Thank you.
figure(9);
line(x1,y1,'Color','r')
ax1 = gca; % current axes
set(ax1,'XColor','r');
set(ax1,'YColor','r')
ax1_pos=set(ax1,'Position');
ax2 = axes('Position',ax1_pos,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
line(x2,y2,'Parent',ax2,'Color','k');

採用された回答

dpb
dpb 2015 年 2 月 26 日
...
ax1_pos=set(ax1,'Position');
ax2 = axes('Position',ax1_pos,...
ax1_pos will be empty after the above; you (probably inadvertendtly) typed set instead of get.
Try
ax1_pos=get(ax1,'Position');
instead.
  1 件のコメント
Aftab Ahmed Khan
Aftab Ahmed Khan 2015 年 2 月 27 日
Oh, thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by