But frankly, the graphs that Matlab spits out with the default settings are pretty ugly. Let me make an example. I generated some data ( y = log10(x)*x ) and added some noise. The plot shows the theoretical curve and the "data".
This looks ok, but to me, the lines are too thin and the font does not look good. First, let's change the size of the output.
I have learned that it is much easier to set the size of a Matlab figure in physical sizes (centimeters) than the default. The following code sets the figure to be 15x12 centimeters.
set(gcf, 'PaperUnits', 'centimeters');
set(gcf, 'PaperSize', [15 12]);
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 15 12]);
Applying this to our figure we get
Looks better, right? Now, let's change the font-size, the line-width and the length of the tickmarks.
Change the ticklength. Use a value close to [0.02 0.025], but you may have to experiment with smaller or larger values for the first parameter (between 0.015 to 0.025) to make it look good.
set(gca, 'TickLenght', [0.02 0.025]);Change the font size. For a figure of this size, 10 points looks good.
set(gca, 'FontSize', 10);Change the linewidths of the axes and of the objects plotted.
set(gca, 'Linewidth',1);and the same for the other handles.
Compared with the first graph, this is a clear improvement.
This will be all for now. In this post I used png files. When making figures for research papers it is required that they use the eps format. There are a few more tweaks that can be made to such figures.
(Many of these techniques were inspired by the post http://blogs.mathworks.com/loren/2007/12/11/making-pretty-graphs/ on Loren on the Art of MATLAB)
No comments:
Post a Comment