axis changing when plotting points

조회 수: 3 (최근 30일)
Jason
Jason 2014년 9월 18일
댓글: Adam 2014년 9월 18일
Im plotting data on an axes using GUIDE. I have a loop where I use the plotyy command to plot 2 graphs, one point at a time. I want to set the axis as fixed which I have done, but wanted to do it once before the loop and have it remain.
It didn't work, so I have to reset the desired Y axis range on each iteration of the loop where I plot the data (one point at a time).
Is there a way where I can fix the axis, but still have the data plot one point at a time in a loop (so I can take the axis stuff out of the loop)?
Thanks Jason

채택된 답변

Adam
Adam 2014년 9월 18일
You should be able to do this by setting:
set( hAxes, 'YLimMode', 'manual' )
( XLimMode or ZLimMode too if required )
and just set your limits before the for loop. Then they should not change as you plot new points, even if the new points fall outside the visible range.
  댓글 수: 2
Jason
Jason 2014년 9월 18일
Perfect Adam, thankyou
Does this work also with things such as markers and colour?
Thanks Jason
Adam
Adam 2014년 9월 18일
Markers and colour are properties of Line objects or whatever you are plotting rather than the axes so I'm not sure what aspect of these you refer to.
By default successive calls to plot will always plot in blue unless you specify the colour yourself.

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

추가 답변 (1개)

Youssef  Khmou
Youssef Khmou 2014년 9월 18일
One method to fix the issue is to place the axis command inside the loop, suppose the limits are :
L=[xmin xmax ymin ymax];
Inside the loop you write :
axis(L)
  댓글 수: 1
Jason
Jason 2014년 9월 18일
Thanks Youseff. I was hoping to avoid doing it inside the loop and wanted to see if I could fix it before the loop, yet still plot data inside the loop.
Thanks

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

카테고리

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