How to add newline to x label of a plot ?

How do I add a new-line to the x label of a plot ? Like i want it to be
Label A \newline
Label B

 채택된 답변

KSSV
KSSV 2017년 1월 23일

6 개 추천

plot(1:10)
xlabel({'hello';'there'})

댓글 수: 3

ylabel({'general';'kenobi'})
Jack Cooney
Jack Cooney 2019년 2월 28일
title({'you are a';'bold one'})
Hello, is there any other way to change line when editing the labels through property inspector? Appreciate any help!

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Jose Rego Terol
Jose Rego Terol 2020년 1월 30일

0 개 추천

I tried this but I got an error.
xlabel({'Time (s)';'foot-Spike:' num2str(fs)})
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
Error in spikes_detection_listdlg (line 36)
xlabel({'Time (s)';'foot-Spike:' num2str(fs)})
How can I include num2str within curly braces?

댓글 수: 2

xlabel({'Time (s)'; ['foot-Spike:' num2str(fs)]})
Jose Rego Terol
Jose Rego Terol 2020년 1월 30일
Works! Thanks!

댓글을 달려면 로그인하십시오.

Naman Shantha KUMAR
Naman Shantha KUMAR 2020년 11월 27일

0 개 추천

I wanted to implement the same in for loop, the below method worked for me;
xlabelname = {}
for ii = 1:10
...
xlabelname{ii,1} = strcat('plot',num2str(ii));
end
Hope it helps if someone is stuck in this part

카테고리

도움말 센터File Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

질문:

2017년 1월 23일

댓글:

2021년 11월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by