Borrar filtros
Borrar filtros

How to add newline to x label of a plot ?

310 visualizaciones (últimos 30 días)
RuiQi
RuiQi el 23 de En. de 2017
Comentada: Ifigenia Aslanidou el 23 de Nov. de 2021
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

Respuesta aceptada

KSSV
KSSV el 23 de En. de 2017
plot(1:10)
xlabel({'hello';'there'})
  3 comentarios
Jack Cooney
Jack Cooney el 28 de Feb. de 2019
title({'you are a';'bold one'})
Ifigenia Aslanidou
Ifigenia Aslanidou el 23 de Nov. de 2021
Hello, is there any other way to change line when editing the labels through property inspector? Appreciate any help!

Iniciar sesión para comentar.

Más respuestas (2)

Jose Rego Terol
Jose Rego Terol el 30 de En. de 2020
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 comentarios
Walter Roberson
Walter Roberson el 30 de En. de 2020
xlabel({'Time (s)'; ['foot-Spike:' num2str(fs)]})
Jose Rego Terol
Jose Rego Terol el 30 de En. de 2020
Works! Thanks!

Iniciar sesión para comentar.


Naman Shantha KUMAR
Naman Shantha KUMAR el 27 de Nov. de 2020
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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by