creating graph with multiple axis
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Réponses (1)
Pratheek Punchathody
le 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 commentaires
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!