Borrar filtros
Borrar filtros

How to Center Align the title for a figure?

28 visualizaciones (últimos 30 días)
Hadi Hajieghrary
Hadi Hajieghrary el 24 de Dic. de 2014
Comentada: Star Strider el 24 de Dic. de 2014
This is the code I use to title my figures:
title('Agent 1 \newline Probability Density Function - Step 1','FontWeight','bold',... 'FontSize',12,... 'FontName','Times New Roman');
The problem is Matlab left-align the text in title:
Agent 1 Probability Density Function - Step 1
which is ugly!. My question is How can I Center-Align it as:
Agent 1
Probability Density Function - Step 1
Thanks, Hadi

Respuesta aceptada

Star Strider
Star Strider el 24 de Dic. de 2014
Editada: Star Strider el 24 de Dic. de 2014
Try this:
ttl = sprintf('Agent 1\nProbability Density Function - Step 1');
title(ttl,'FontWeight','bold', 'FontSize',12, 'FontName','Times New Roman');
  2 comentarios
Hadi Hajieghrary
Hadi Hajieghrary el 24 de Dic. de 2014
Great! Thanks.
Hadi
Star Strider
Star Strider el 24 de Dic. de 2014
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by