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

96 Ansichten (letzte 30 Tage)
KW YAN
KW YAN am 7 Mär. 2023
Beantwortet: Sarvesh Kale am 7 Mär. 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

Akzeptierte Antwort

Sarvesh Kale
Sarvesh Kale am 7 Mär. 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

Weitere Antworten (0)

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by