Clipping property doesn't work?
조회 수: 4 (최근 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:
And it is OK.
But if i change second plot command to bar, stairs or stem, the results are:
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!