Borrar filtros
Borrar filtros

How to add blank space using text function?

8 visualizaciones (últimos 30 días)
John
John el 13 de Jun. de 2017
Respondida: Star Strider el 13 de Jun. de 2017
Using text function,
x = 1;
y = 1;
str1 = '1 2 3 4 5 6 7 8 9';
str2 = '4 5 6';
text(x, y, {str1; str2})
I would like to center str2 under str1 in the plot. Using a blank space before the characters in str2 does not seem to shift the characters appropriately. How can blank spaces be entered?

Respuesta aceptada

Star Strider
Star Strider el 13 de Jun. de 2017
Use the 'HorizontalAlignment' name-value pair option.
This does what you want when I ran it (in R2017a):
text(x, y, {str1; str2}, 'HorizontalAlignment','center')

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by