Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Creating User Interfaces Up: Graphics Previous: Default Properties

Labelling

People often want to change the axes and labels that the default setting provides. The size and style of fonts, axes labels and the numbering along the axes can all be controlled using menu options or the set command. Here's an example that also shows how to use greek characters.

surf(peaks(10));
% Make the axis numbering smaller than usual
set(gca,'FontSize',8)
% Have z tic marks at intervals of 0.5
set(gca,'ZTick',-8:0.5:8)
set(gca,'ZTickLabel',-8:0.5:8)
% Label the Z axis 
zlabel = get(gca,'ZLabel');
set (zlabel,'String','D(b/3)')
set (zlabel,'FontName','Symbol')

The text command can deal with maths and changes of font styles. For example,

text(0,1,'{\bf bold} \alpha=x^3. \Sigma x \leq \int y \forall x')
works as LATEX users might expect. The title and labelling commands are similar. More colorful information can be added by using



© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-24