How to align xaxis when using yyaxis
조회 수: 2 (최근 30일)
이전 댓글 표시
I would like to align the yaxis automatically of two plot when using yyaxis. Here's an example of the problem:
time = 0:1:10;
s=sawtooth(time);
v=-2:1:8;
yyaxis('left');
plot(time,s);
ylabel('s');
yyaxis('right');
plot(time,v);
ylabel('v');
When doing this, the y=0 of the left signal is align with the y=3 of the right signal in yaxis. How could it be both align on y=0? I still want to matlab to decide of the tick, min and max value of the yaxis, I just want the zeros to be align.
댓글 수: 1
dpb
2016년 11월 14일
편집: dpb
2016년 11월 16일
Can't have Matlab be automagic in choosing the limits and still force the origin to be someplace specific--too many constraints with too few variables.
You'll have to do this by computing consistent ranges from those chosen and figure out what new scaling on ticks or ranges would be required to make the origins match up, sorry...
ADDENDUM What you were probably looking/wishing for is a property to set the origin location arbitrarily--unfortunately, the only property values yet implemented remain '[origin|bottom|top]' for y-axis and similarly for x. A general value isn't allowed.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!