MATLAB: How to create an axis label with multiple line using the LaTeX interpreter in MATLAB 7.7 (R2008b)

axisinterpreterlabelslatexlinesMATLABmultiple

For my plot I would like to have an axis label with multiple lines using the LaTeX interpreter.

Best Answer

Axis labels with multiple lines must be defined as a cell array where each line of text is an element of the cell array.
The following code illustrates an example where the z-axis is labeled with multiple lines using the LaTeX interpreter.
close all; clear all; clc;
f = surf(peaks);
xlabel('$$\textbf {xdata}$$', 'interpreter','latex');
ylabel('$$\textbf {ydata}$$', 'interpreter','latex');
zlabel({'$$\textbf {\hspace{0.1mm} Peak}$$', '$$\textbf {Values}$$'},'interpreter','latex');
The same procedure can be used to create a title with multiple lines.