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 Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by