Figure Xlabel

figure xlabel

In two-dimensional graphics, figure xlabel labels the x axis. In three-dimensional graphics, it labels the y axis or the z axis. It also may label the figure title in some cases.

Text properties determine the appearance of a label, including size and font. These properties are set using the xlabel, ylabel, cblabel and title commands. In addition to these commands, a variety of other methods can be used for modifying the appearance of text in graphs. For example, a title( ) function can be used to add a title for a figure, and many graphical parameters can be modified with the stext( ), mtext( ) and textcolor( ) functions.

A xlabel command has the form hax, where hax is an axes handle or a graphics object handle returned by gca(h). If the first argument is an axes handle, the commands operate on that axis instead of the current axes in the graph returned by gca(h). The optional return value hleg is a graphic object handle to the legend label that MATLAB creates for the xlabel.

In the xlabel( hax ) and ylabel( hax ) commands, an optional list of property/value pairs is provided to modify the appearance of the label. The first argument, hax, is an axes or graphics object handle that specifies the target to be labeled. If you do not specify a target, MATLAB adds the label to the current axes or standalone visualization. The second argument, txt, is the text to be used as the label.

pos = the position of the text in relation to the axis (-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38). wt = the width of the text in points, including spaces. if pos is 1 or -2, it specifies a margin (-1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16). if pos is 3 or 4 or if len(txt) > 0: txt = the text to use for the label.

if txt is a hexadecimal or decimal number, the characters will be converted to digits. If txt is a string, the backslash characters in the text are converted to forward slashes. In some terminals, these conversions can cause a space to be inserted between each character in the label. In other terminals, these conversions can cause txt to be split up into multiple lines. In some terminals, this can cause the xlabel to overwrite a left-most x2tic label if it is placed in the same position as the ylabel. This problem can be remedied by adjusting the ylabel or the left margin.