creating graph with multiple axis
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Antworten (1)
Pratheek Punchathody
am 11 Sep. 2020
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"
0 Kommentare
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!