Check which is the startup file through the command:
which startup
and add in the same directory the included script 01_graphic_defaults.m
. Add in the startup file
the line
run 01_graphic_defaults
- always uses opengl as default renderer
- set up figure position and dimension units to centimeters
- set up the paper to a custom dimension (intead of a standard one)
- set up dimensions for figure: 18cm width x 15cm width
- set up dimensions for output paper: 18cm width x 15cm width
- figure background color is white
- figure fonts are all set to Palatino, with scaling for title fixed
- grid are on by default, both on X and Y
- for all text interpreter is set to LaTeX (thus rember to use $ to open/close math mode)
To show/export an image 10cm x 12cm use the following code:
figure('Position', [0, 0, 10, 12], 'PaperSize', [10, 12])
scatter(0:99, rand(100,1));
% Exporting command
saveas(gcf, '02_figure.pdf');
This method guarantees that the dimension of the output file are consistent with the configuration.