creating graph with multiple axis

2 ビュー (過去 30 日間)
Satyam Singh
Satyam Singh 2020 年 7 月 22 日
回答済み: Pratheek Punchathody 2020 年 9 月 11 日
I am trying to create a graph with 2 x axis and 2 y axis. I got a code which is working fine but there is an issue. it is not able to relate both the x axis.
So this the graph I am getting using the code below and the excel sheet attached here-
x1 = cell2mat (Nickel(:,3));
y1 = cell2mat(Nickel(:,1));
line(x1,y1,'Color','r')
ax1 = gca; % current axess
ax1.XColor = 'r';
ax1.YColor = 'r';
ax1_pos = ax1.Position; % position of first axes
ax2 = axes('Position',ax1_pos,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
x2 = cell2mat(Nickel(:,4));
y2 = cell2mat(Nickel(:,2));
line(x2,y2,'Parent',ax2,'Color','b')
the problem that I am having is both the x axis are not related which means the red curve should be formed according to x1,x2 and y1. If you see the image below for reference just look at the peak number 6 of blue colored curve it is coming after 20 in fractions but in above graph it is before 20. So this the problem that I am not able to figure out. Please help me.
  1 件のコメント
Sugar Daddy
Sugar Daddy 2020 年 7 月 22 日
maybe because it is semilogx

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

回答 (1 件)

Pratheek Punchathody
Pratheek Punchathody 2020 年 9 月 11 日
Hi Satyam
plotxx is one of the several submissions in MATLAB File Exchange on MATLAB Central which is a forum for our product users to interact, exchange information and knowledge, without MathWorks' involvement. Feel free to contact the author of this submission directly for specific questions about the implementation"

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by