Setting the default font for data tips in MATLAB

For quite some time I thought that it was impossible to change the font size of the data tips you can add to plots in MATLAB.  This was very frustrating because I would use these figures in reports and the font on the data tip would be almost illegible.   So I started digging deeper on Google and experimenting, trying to find a way to increase this font.   Finally I figured out a way:

In your startup.m file, which is normally within the MATLAB folder that is located in My Documents or somewhere similar, you can add the following two lines to the bottom of the file:

set(0,’DefaultTextFontName’,’Arial’) % Sets Font Style
set(0,’DefaultTextFontSize’,12) % Sets Font Size

Now, when you generate a new figure in MATLAB (any open figures before you made this change will need to be regenerated), and place a datatip, it will generate the corresponding x and y axis information in nice big font.

2 comments on “Setting the default font for data tips in MATLAB
  1. Aparna says:

    Tried that, doesn’t really work. what am I missing?

    • corwinolson says:

      Hi Aparna,

      You tried creating a startup.m file and adding those commands? If that doesn’t work, perhaps in your plotting script/function, after you employ the plot command, try the following:
      set(gca,’FontSize’,18)
      Or whatever fontsize you want.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.