How to plot three Y-axes with same X-axis in matlab

5 Ansichten (letzte 30 Tage)
sushma gunde
sushma gunde am 15 Sep. 2015
Kommentiert: DGM am 7 Mär. 2025
x1=(0:43:(3*43)); Y1=
x2=[1:1:134]; Y2=
x3=[50:60:170]; Y3=
[ax,hlines] = plotyy(X1',Y1',X2',Y2')
ax(3)=axes('Position','Color','none','XColor','k','YColor','r',...
'yaxislocation','right');
hlines(3)=line(X3',Y3', 'Color', 'g', 'LineStyle', '-', 'Marker', '.', 'Parent', ax(3));
I have tried using this code but the second y axis and third y axis are getting overlapped. Can you suggest me some ideas

Antworten (2)

Joseph Cheng
Joseph Cheng am 15 Sep. 2015
Easiest solution is to browse the file exchange. a quick search provided me with http://www.mathworks.com/matlabcentral/fileexchange/9016-addaxis.
  2 Kommentare
Leo Daniel
Leo Daniel am 7 Mär. 2025
This remains functional, but in newer versions (tested on 2021a), a 'colorord' error is encountered. Users should refer to the Discussions page for troubleshooting before proceeding with this File Exchange.
DGM
DGM am 7 Mär. 2025
In aa_plot.m, there are a number of cases where axes properties are queried and set. The problem is the use of abbreviated 'colorord' property name. It should be 'colororder'. Correct all instances of the abbreviated name.
cord = get(gca,'colorord'); % change these
cord = get(gca,'colororder'); % to these

Melden Sie sich an, um zu kommentieren.


shalenys bedoya
shalenys bedoya am 12 Mai 2017
There's a function on the file exchange that could works.
https://www.mathworks.com/matlabcentral/fileexchange/1017-plotyyy

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by