[GUI]How to set format for figure title
14 次查看(过去 30 天)
显示 更早的评论
I want to use formatted strings on figure title. Is there any way to do it?
回答(3 个)
Joseph Cheng
2014-7-17
编辑:Joseph Cheng
2014-7-17
there is good documentation here http://www.mathworks.com/help/matlab/ref/title.html which will give you all the parameters you can set. You can also use the property editor to edit a figure to how you want it to look and use the file->"Generate as Code" to see what commands are needed to say get a figure to look like what you want.
Image Analyst
2014-7-17
The font (size, style, color, etc.) of any window's title bar (like what you grab and drag to move figure windows around) is set by the operating system. However you can have a figure with a title above an axes , or some static text label where you can customize the font appearance.
3 个评论
Image Analyst
2014-7-18
编辑:Image Analyst
2014-7-18
Well then I guess the answer is "No - not in MATLAB". You can change the title bar via the OS, but in MATLAB all you can change is the text of the title bar - not the format (font, size, style, color, etc.)
When you say "All window style will change if modify the OS options." that is not exactly true. You can change some, probably most, things, but others can be overridden by what your app says , for example text in the application area of your app (e.g. static text labels in MATLAB GUIs). The title bar text is not one that can be overwritten as far as I know. I've not seen it done in any application, unless a totally custom "skin" was written.
Just checking again - by "figure title" you meant the title bar (what you click and drag to move the window) and did not mean the "title" for an axes (a plot, chart, image, graph, etc.) which is essentially a static text in the application area above the axes and NOT in the title bar. Some people sloppily use "axes" and "figure" interchangeably - I hope you're not doing that because they're different entities!
Image Analyst
2014-7-18
Geoff Hayes
2014-7-18
The figure title can be changed with the following lines of code
h = figure;
set(h,'NumberTitle','off') % removes the 'Figure X' title where X is an integer
set(h,'Name','New Name of Figure!'); % sets the name of the figure
The parameter for 'Name' can be a string that you have already chosen i.e.
figTitleName = sprintf('New Figure with the number %d',42);
set(h,'Name', figTitleName);
I'm not sure if there is a way to change the font size, colour, etc.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!