Effacer les filtres
Effacer les filtres

How to modify the veritcal position of sgtitle in a figure?

101 vues (au cours des 30 derniers jours)
KW YAN
KW YAN le 7 Mar 2023
Hi,
I have read that there is a property "HorizontalAlignment" in sgtitle() object to adjust the horizontal alignment of the text.
I am curious to know if there is any way to modify the veritcal position of the sgtitle text? Thanks!
Best regards,
Kelvin

Réponse acceptée

Sarvesh Kale
Sarvesh Kale le 7 Mar 2023
Hi KW YAN,
You can insert your own title box using annotations, refer the following code
figure;
subplot 211
subplot 212
annotation('textbox',[0.15 0.9 0.1 0.1],'String','Title String','EdgeColor',[105/255 105/255 105/255])
% [0.15 0.9 0.1 0.1] means position the textbox at 0.15 units from figure window left, 0.9 units up from figure window bottom and 0.1x0.1, where 1x1 represnts the whole figure
More information on annotation can be found here. When you go to the properties page of sgtitle, we cannot find the property for verticle alignment, I hope the above workaround helps, if it does not wait for someone from community to answer !
Thank you

Plus de réponses (0)

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by