Why is the line plotting beyond the box?

11 ビュー (過去 30 日間)
Omar Alamoudi
Omar Alamoudi 2017 年 12 月 2 日
コメント済み: Omar Alamoudi 2017 年 12 月 3 日
I have been encountering this problem lately, and I don't know how to solve it. Using the plot function, the line plotted would go beyond the box. Any idea how to fix this? See figure below in the top right corner.
P.S. I have just upgraded my Matlab from 2016a to 2017b, and the issue was there before.
  2 件のコメント
Star Strider
Star Strider 2017 年 12 月 2 日
I never encountered that.
It will help greatly if we have your code and relevant data if to see if we can reproduce that problem.
Image Analyst
Image Analyst 2017 年 12 月 2 日
Maybe you somehow created the axes, then put hold on (to lock everything down), and then plotted some data that went beyond the axes limits. Hard to say for certain since you didn't include your code.

サインインしてコメントする。

採用された回答

the cyclist
the cyclist 2017 年 12 月 3 日
編集済み: the cyclist 2017 年 12 月 3 日

This behavior is governed by the "Clipping" property of the axes. It must have been set to "off" somehow. For example,

x = 1:0.1:11;
y = x;
figure
plot(x,y)
xlim([0 10])
set(gca,'Clipping','off')

yields

Try

set(gca,'Clipping','on')
  1 件のコメント
Omar Alamoudi
Omar Alamoudi 2017 年 12 月 3 日
Thank you very much, this was actually the problem, for some reason I had the DefaultLineClipping set to 'off' in my startup script, I just fixed that and now I'm getting the desired behavior.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by