Clipping property doesn't work?

4 vues (au cours des 30 derniers jours)
Grzegorz Knor
Grzegorz Knor le 21 Nov 2013
Modifié(e) : dpb le 21 Nov 2013
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?

Réponse acceptée

dpb
dpb le 21 Nov 2013
Modifié(e) : dpb le 21 Nov 2013
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.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Object Properties dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by