| Contents | Index |
To control the presence and appearance of axis labels on a graph,
use the Property Editor plotting tool
. For details, see The
Property Editor in the MATLAB Graphics documentation.
ylabel('string')
ylabel(fname)
ylabel(...,'PropertyName',PropertyValue,...)
ylabel(axes_handle,...)
h = ylabel(...)
Every axes graphics object can have one label for the y-axis. The label appears beneath its respective axis in a two-dimensional plot and to the side or beneath the axis in a three-dimensional plot.
ylabel('string') labels the y-axis of the current axes.
ylabel(fname) evaluates the function fname, which must return a string. Then it displays the string beside the y-axis.
ylabel(...,'PropertyName',PropertyValue,...) specifies property name-value pairs for the text graphics object created by ylabel.
ylabel(axes_handle,...) plots into the axes with handle axes_handle instead of the current axes (gca).
h = ylabel(...) returns the handle to the text object used as the label.
Reissuing ylabel command causes the new label to replace the old label.
For three-dimensional graphics, MATLAB puts the label in the front or on the side, so that the plot does not hide it.
This example shows how to give a string as input to ylabel.
ylabel('Population');Passing a numeric input as input to the function.
ylabel(123);
Passing a handle as input to ylabel.
h = figure; ylabel(h);
This example displays the label in multiple lines.
ylabel({2010;'Population';'in Years'});This example shows you how to use name-value pairs in ylabel.
ylabel('Population','fontsize',12,'fontweight','b','color','r');When resizing the figure window, you may want to display graph to the scale or be able to see the text in title and labels completely. For more information about this, see Properties Controlling Axes Size.
strings | text | title | xlabel | zlabel

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |