Using plotyy my 2nd Y axis is not depending on X axis when I introduce limits to X axis.
4 次查看(过去 30 天)
显示 更早的评论
I have 2 Y axis (Y1 acceleration and Y2 Velocity), and 1 X axis (time) I am using plotyy to plot 2 curves
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
[ax,hlines(1),hlines(2)] = plotyy(t,Acc,t,Ve);
cfig = get(gcf,'color');
pos = [0.1 0.1 0.7 0.8];
offset = pos(3)/5.5;
xlabel('Time (ms)')
xlim([-80 60])
set(ax(1),'YLim',[-80 50])
set(ax(1),'YTick',[-80:20:50])
set(ax(2),'YLim',[-20 45])
set(ax(2),'YTick',[-20:10:45])
grid on
title('Test 01')
ylabel(ax(1),'Acceleration (g)');
ylabel(ax(2),'velocity (km/h)');
axis on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The problem is my Y2 (Velocity) is not fixed with X axis. When i changed X limit "xlim([-80 60])" to "xlim([-80 20])" the Y2 (velocity) plot remains same size. But I need to zoom it in the particular interval.
Please help me.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!