Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Default Properties Up: Using Matlab at CUED Previous: Info and help commands

Graphics

Though it's not essential to know how matlab graphics are organised, it's likely to be useful sooner or later.

Figures are made of of objects (lines, text, images etc). They 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, set(gcf,'Color','green') sets the color of the current figure to 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 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.



 
next up previous contents
Next: Default Properties Up: Using Matlab at CUED Previous: Info and help commands
© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-24