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

101 次查看(过去 30 天)
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

采纳的回答

Sarvesh Kale
Sarvesh Kale 2023-3-7
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by