intercept of secondary axis
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Azzi Abdelmalek
2013-1-19
编辑:Azzi Abdelmalek
2013-1-19
After plotyy add this:
yt=get(gca, 'ytick');
yt(1)=[];
set(gca,'ytick',yt)
4 个评论
更多回答(1 个)
Azzi Abdelmalek
2013-1-19
编辑:Azzi Abdelmalek
2013-1-19
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 个评论
Azzi Abdelmalek
2013-1-19
编辑:Azzi Abdelmalek
2013-1-19
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!