Plotyy problem, curves incomplete

조회 수: 1 (최근 30일)
Jeremy le Gall
Jeremy le Gall 2015년 7월 23일
댓글: dpb 2015년 7월 23일
Hello everyone,
I am beginning with Matlab, and I am trying to plot a lot of datas. In fact, I am using a plotyy to plot 5 curves on the first y-axis and one on the second. And I don't know why, but all the curve plotted on the second axes will be incomplete. Meaning that for example all my datas are from t [0;150]. My first axis curves are going until t=150, but on the second graph, they stop around 140.
I looked at the variables, but everthing is fine their (I have all the necessary datas). I also tried to reduce the x axis (from [0;150] to [0,130]) but I have also the same problem, datas on the second y-axis stop around 120. I really don't understand why. Maybe this is just coming from the plotyy but I really do not understand why.
Thanks in advance for your help everyone!
My code is attach to this post

채택된 답변

dpb
dpb 2015년 7월 23일
편집: dpb 2015년 7월 23일
Would need the data to go along with the m-file to see for certain but I note that you have one xlim call with no axes specified--my best guess is you have different x limits on the two owing to that.
I suggest after
[ax,H1,H2]=plotyy(...
follow with
linkaxes(ax,'x') % link the two x-axes to match up with each other automagically
xlim(ax(1),[0 150])
and there's a good chance your problem will be cured. Otherwise, as noted, will need the data to reproduce the problem.

추가 답변 (1개)

Jeremy le Gall
Jeremy le Gall 2015년 7월 23일
Fantastic, thank you a lot!!
However, I think you made a mistake, it is not as, but ax in your linkaxes!
But thank you for such a rapidity! I will come back here!
have a nice day
  댓글 수: 1
dpb
dpb 2015년 7월 23일
Use 'Comment' for comments rather than 'Answer', but yes, was a typo; thanks. Corrected the Answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by