[GUI]How to set format for figure title

14 views (last 30 days)
Linzu
Linzu on 17 Jul 2014
Commented: Image Analyst on 18 Jul 2014
I want to use formatted strings on figure title. Is there any way to do it?
  1 Comment
Geoff Hayes
Geoff Hayes on 17 Jul 2014
Please elaborate on what you mean by formatted strings.

Sign in to comment.

Answers (3)

Joseph Cheng
Joseph Cheng on 17 Jul 2014
Edited: Joseph Cheng on 17 Jul 2014
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.
  1 Comment
Linzu
Linzu on 17 Jul 2014
Thanks for reply. What I want to set is the title format of the Figure, Not axes.
set( fig_h, .....

Sign in to comment.


Image Analyst
Image Analyst on 17 Jul 2014
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 Comments
Image Analyst
Image Analyst on 18 Jul 2014
Edited: Image Analyst on 18 Jul 2014
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!

Sign in to comment.


Geoff Hayes
Geoff Hayes on 18 Jul 2014
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.
  1 Comment
Linzu
Linzu on 18 Jul 2014
Me too. I believe there will be a way, although it is not known. Thanks.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!