Effacer les filtres
Effacer les filtres

How to Center Align the title for a figure?

26 vues (au cours des 30 derniers jours)
Hadi Hajieghrary
Hadi Hajieghrary le 24 Déc 2014
Commenté : Star Strider le 24 Déc 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

Réponse acceptée

Star Strider
Star Strider le 24 Déc 2014
Modifié(e) : Star Strider le 24 Déc 2014
Try this:
ttl = sprintf('Agent 1\nProbability Density Function - Step 1');
title(ttl,'FontWeight','bold', 'FontSize',12, 'FontName','Times New Roman');
  2 commentaires
Hadi Hajieghrary
Hadi Hajieghrary le 24 Déc 2014
Great! Thanks.
Hadi
Star Strider
Star Strider le 24 Déc 2014
My pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by