|Department of Engineering|
|University of Cambridge > Engineering Department > computing help|
Figures are made of objects (lines, text, images etc). Objects have properties (like Color, Position, etc) which can be individually controlled. Each object has a handle (a unique identifier). To experiment with handles, create a simple graph by typing `plot(1:3)'. Typing `gcf' returns the handle of the current figure. `get(handle)' lists the properties of the given object, so get(gcf) lists all the properties of the current figure. You can use set to change the values of these properties once you know the handle of the object and name of the property. For example, to set the foreground color of the current figure to green, use set(gcf,'Color','green'). If you type set(gcf) you get a list of the properties of the current figure, and alternative settings for these properties.
The axes are children of the figure - and consequently inherit some of the figure's properties. If you type get(gcf,'Children') you'll get the axes handle, which you could also get by typing `gca'. The axes in turn can have children.
`set' is a powerful mechanism. Often matlab has commands that spare you needing to use set directly, but particularly if you want to retrospectively fix something, the facility is useful.
|| computing help ||