Data is not contained within x-axis limits

조회 수: 1 (최근 30일)
Andy Wang
Andy Wang 2021년 2월 19일
편집: Adam Danz 2021년 2월 22일
All,
So essentially I have an issue where if I zoom into a plot through a scroll wheel or a box, some of the data displayed extends past the x-axis limits as shown in the picture below.
The plot is located within an application I am building using App Designer. Do I need to reset the xlim or something within a callback function?
Insights would be greatly appreciated.
Thanks.
  댓글 수: 1
Mario Malic
Mario Malic 2021년 2월 20일
This shouldn't happen, it's a bug, maybe you could contact customer service.
When it does happen, try resizing the app. Maybe you could create a button that triggers drawnow and see if it helps.

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

답변 (1개)

Adam Danz
Adam Danz 2021년 2월 20일
편집: Adam Danz 2021년 2월 22일
Get the handle to the line object and look at the Clipping property. If it's set to 'off' figure out what part of the code changed it from the default 'on' and fix it or just set it to on.
If clipping wasn't the issue, check that there isn't an invisible axis that hosts the line object. Get the line object handle and use ax=ancestor(h,'axes') to get the parent axes of the line object. Then delete the axes using delete(ax). If you still see the axes then you know you've just deleted an invisible axes with a larger extent than the visible axes.
If you've ruled out the clipping problem and invisible axes, contact tech support: Contact Us - MATLAB & Simulink
Example of clipping issue:
x = 0 : .01 : 10;
y = rand(size(x));
h = plot(x,y);
ylim([-5,5])
h.Clipping = 'off';
xlim([2,8])

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by