plotyy : align y axes at zero
이전 댓글 표시
When using plotyy I need to plot two different series. One on the left y axis, and the other on the right y axis. Both series contain numbers in different scales. The one of the left contains numbers from 0 to (potentially) Infinity, but the one on the right is restricted to the range -1, 1. In the code below, you can see an example.
I'd like to make sure that both axes cross at y = 0, but I'm not sure how to do it. In the example I included, you can see that the two y axes are misaligned.
Thanks in advance
x = 15;
fn1 = @(x, y) bar(x, y, 0.3, 'FaceColor', 'blue');
fn2 = @(x, y) bar(x, y, 0.3, 'FaceColor', 'red');
figure;
plotyy( [1:x]-1, rand(x, 1) * 100, [1:x]+1, 2 * rand(x, 1) - 1, fn1, fn2)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Two y-axis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!