Clipping property doesn't work?
2 ビュー (過去 30 日間)
古いコメントを表示
It seems that clipping property doesn't work for plot objects like bar, stem, stairs.
See simple exapmle:
plot(1:10,5:-0.5:0.5,'r')
xlim([0 10])
ylim([0,5])
hold on
h=plot(1:10,2:.5:6.5);
set(h,'Clipping','off')
The result is as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153163/image.png)
And it is OK.
But if i change second plot command to bar, stairs or stem, the results are:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153164/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153165/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153166/image.png)
Is this the correct behavior of MATLAB?
0 件のコメント
採用された回答
dpb
2013 年 11 月 21 日
編集済み: dpb
2013 年 11 月 21 日
Well, "correct" is in eyes of beholder...it is the behavior as implemented; whether the other plot types should inherit 'clipping' property state from other is a design decision.
After your above from the command line...
>> hb=bar(1:10,2:.5:6.5);
>> get(hb)
Annotation: [1x1 hg.Annotation]
DisplayName: ''
HitTestArea: 'off'
BeingDeleted: 'off'
ButtonDownFcn: []
Children: 189.0079
Clipping: 'on'
...
>> get(get(hb,'children'))
AlphaDataMapping = scaled
Annotation = [ (1 by 1) hg.Annotation array]
CData = [ (4 by 10) double array]
CDataMapping = scaled
...
BeingDeleted = off
ButtonDownFcn =
Children = []
Clipping = on
...
...
So, to turn the effective clipping property for these child objects you've got to go handle-diving and get to the bottom...
>> set(get(hb,'children'),'clipping','off')
will do so for the bar plot; similar machinations for the others.
ADDENDUM:
Note that for consistency the behavior is similar in that plot returns a line object handle whereas the others are composite objects the actual data drawn of which is at a lower level. Hence the need to "handle-dive" into the guts to get the point level at which the 'clipping' property needs must be set.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Object Properties についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!