Graphics Programs Reference
In-Depth Information
But we have made a mistake: the “x” should be lower case. We try to
correct it by issuing another text command with a lower case “x”:
But this has printed over the top of the previous label, making a mess.
Without starting again, we can use the delete function to delete the
text objects, once we know their handles. We can get a list of the handles
of the line and the text objects by getting all the children of the current
>> h = get(gca,'children')
The variable h is a three-element column vector (the actual values are
not important). These are the handles corresponding to the Line object
(parabola) and the two Text objects. But which of them is the Line
object and which are the Text objects? We can get the object types
corresponding to these handles by typing:
>> types = get(h,'type')
types =
(The variable types is returned as a cell array.) A parent's children
are always listed in reverse age order: the most recently drawn object
appears first—youngest first, oldest last. This tells us that the first two
elements of the vector h correspond to the text objects ' f(X) ' and ' f(x) ',
in that order, and the third element corresponds to the parabolic line.
We can delete the two text objects by typing:
Search WWH ::

Custom Search