How do I place a two-lined title, x-label, y-label, or z-label on my plot?
347 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 8 Mai 2013
Bearbeitet: MathWorks Support Team
am 12 Jun. 2017
I would like to create a multi-lined title, x-label, y-label or z-label. I would like to know if there are any functions in MATLAB that allow me to create a title that uses multiple lines.
Akzeptierte Antwort
MathWorks Support Team
am 12 Jun. 2017
Bearbeitet: MathWorks Support Team
am 12 Jun. 2017
You can create multi-line text using a cell array. For example, this code creates a title and an axis label with two lines.
plot(1:10)
title({'First line';'Second line'})
xlabel({'First line';'Second line'})
For more information about creating multiline text, see
0 Kommentare
Weitere Antworten (1)
Karan Gill
am 31 Okt. 2016
Replace spaces with "\newline".
labels = {'line1 line2','line1 line2','line1 line2'};
labels = cellfun(@(x) strrep(x,' ','\newline'), labels,'UniformOutput',false);
a = gca;
a.XTickLabel = labels;
Karan | Symbolic Math documentation
0 Kommentare
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!