hgtransform
Transform graphics objects
Description
h = hgtransform
creates a Transform
object
in the current axes. If no axes exist, then hgtransform
creates
new axes. Use h
to query and set properties of the
Transform
object after creating it. For a list of properties,
see Transform Properties.
You can use a Transform
object as a container for transforming a
group of graphics objects without having to modify the coordinate data of each
object. Group objects by parenting them to a single Transform
object, and then and perform transformations, such as
translations, scaling, and rotations, on the Transform
object to
modify the child objects as a group.
h = hgtransform(
sets
properties of the Name,Value
)Transform
object using one or more name-value
arguments. For example, hgtransform(Matrix=M)
creates a
Transform
object with transform matrix M
in
the current axes. For a list of properties, see Transform Properties.
Examples
Input Arguments
Limitations
A
Transform
object can be the parent to any number of graphics objects, but it can contain only objects from the same axes.
Tips
Many plotting functions clear the axes (remove axes children) before drawing the graph. Clearing the axes also deletes any
Transform
objects in the axes. For example, if you create aTransform
object and then useplot
, theTransform
object is deleted.h = hgtransform; p = plot(1:10); h.Matrix;
Invalid or deleted object.
You can return the child objects of a
Transform
object to their original orientation, position, and size by setting the transform matrix to the identity matrix. For example, return the child objects of transformt
to their original state after applying the transform matrixM
.Transform operations are defined in absolute terms rather than relative to the current transform, so the identity matrix resets all previous transformations. For more information on the identity matrix, see thet = hgtransform(Matrix=M); ... t.Matrix = eye(4);
eye
function.You can parent a
Text
object to aTransform
object, but scaling and rotating transform has no effect on the text. To change the font size and orientation of the text, instead set text properties, such asTextSize
andRotation
. For more information, see Text Properties.You can parent a
Light
object to aTransform
object, but the transformations do not affect the position of the light. To modify the position and orientation of a light source, instead set thePosition
property of theLight
object. For more information, see Light Properties.
Version History
Introduced before R2006a