intercept of secondary axis
Afficher commentaires plus anciens
Hi,
Im plotting two lines using two axis. They are velocity and acceleration. My question is how can I make the 0 point on the two axis be at the same level? At the moment, the 0 on the secondary axis is inline with 50 on the primary axis.
plotyy(x,y1,x,y2,'plot');
Thank you
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 19 Jan 2013
Modifié(e) : Azzi Abdelmalek
le 19 Jan 2013
Try this
close;
x=0:250;
y1=100*abs(sin(0.01*x)),
y2=10*cos(.04*x);
[ax,h1,h2]=plotyy(x,y1,x,y2,'plot');
yt=get(ax(1), 'ytick');
yt(1)=[];
set(ax(1),'ytick',yt)
5 commentaires
John
le 19 Jan 2013
Azzi Abdelmalek
le 19 Jan 2013
What is the problem? the first axis or the second? Explain again clearly what do you want to get
Azzi Abdelmalek
le 19 Jan 2013
It will be helpful if you post your code
John
le 19 Jan 2013
Azzi Abdelmalek
le 19 Jan 2013
Modifié(e) : Azzi Abdelmalek
le 19 Jan 2013
Ok, I get it now, use
ylim=get(ax(1), 'ylim');
ytick=get(ax(1), 'ytick');
set(ax(2),'ylim',ylim,'ytick',ytick)
but you will loose the negative part
Catégories
En savoir plus sur Two y-axis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
