Plotting Figures for Publications using MATLAB

Personally, I use MATLAB to code for my simulations, save results as .txt or .csv files, and print figures in .eps format for LaTeX. It is quite tricky to generate a nice scientific figure. There are many things you need to think about, such as the type of the font, the font size, the line width, the figure size, the format of the figure, etc. To save some time and keep all your figures in the same format, I suggest creating a MATLAB setting file for all your figures. And, this post is about how to make it properly. Here we go.

My customary MATLAB file for figures is as the following:

% Set the default font type
set(0,DefaultAxesFontName,Times New Roman);
set(0,DefaultTextFontName,Times New Roman);

% Set the default font size to 16 pt
set(0,DefaultAxesFontSize,16);
set(0,DefaultTextFontSize,16);

% Set the size of the marker 8 pt
set(0,DefaultLineMarkerSize,8);

% Set the default line width to 1.5 pt
set(0,DefaultLineLineWidth,1.5);

% Set grid on as default
set(0,DefaultAxesXGrid,on);
set(0,DefaultAxesYGrid,on);

% Set LaTeX as the default interpreter
set(0,DefaultTextInterpreter,latex);
set(0,DefaultLegendInterpreter,latex);

% Set the default MATLAB colours
DefColour.blue = [0.0000,0.4470,0.7410];
DefColour.red = [0.8500,0.3250,0.0980];
DefColour.yellow = [0.9290,0.6940,0.1250];
DefColour.purple = [0.4940,0.1840,0.5560];
DefColour.green = [0.4660,0.6740,0.1880];
DefColour.cyan = [0.3010,0.7450,0.9330];
DefColour.brown = [0.6350,0.0780,0.1840];

As you can see from the code, the font type is set as New Time Romance, which is the routine font for scientific journals. The font size is 16 pt, which is normally scaled properly for the two-column format. The marker is sized to 8 pt and the line width is 1.5 pt. I turn on the grid as default, because my plots are line charts. I use LaTeX as the default text interpreter. In MATLAB, the default interpreter is TeX. The LaTeX interpreter makers the labels, legends, and captions look better. I also added the default MATLAB colours in the code. Instead of pure blue or red, these colours look nicer in figures, I feel.

I put this file, which is named as JL_figure_set.m in my default MATLAB path. When I need to plot something, then I run it using run(JL_figure_set.m);.

That is it.
Cheers!