set_plot
High-quality MATLAB graphics tool
Click here to download.
Click here for documentation and help.
Description
The point of set_plot
is to make the creation of high-quality graphics in MATLAB much easier. MATLAB's figure creation capabilities are very popular, but the quality of the graphics is pretty poor without a little more work. The default fonts are poor, the resulting graphics are too large for use in articles, and saving to PDF format always saves to a full sheet of paper regardless of the size of the graphic.
Consider the following example. You can download a MATLAB script that will run the example automatically. The actual plot uses a built-in command called peaks
to generate a contour plot.
>> contour(peaks(50))
The resulting graphic, saved as a PNG, is below.
Apply a little set_plot
magic using
>> set_plot(gcf, 'FigureStyle', 'journal')
and the result is
A slightly different application of set_plot
,
>> set_plot(gcf, 'FigureStyle', 'fancy', 'Width', 6)
>> set_colormap('jet')
yields a larger, more colorful image.
This example demonstrates some of the flexibility of the options that can be used with the set_plot
command, but it does not demonstrate one of the key advantages because MATLAB already saves bitmap graphics to files with reasonable spatial dimensions. However, if you look at the PDFs of the above images (here, here, and here, respectively), you will notice that MATLAB on its own does not do an acceptable job of saving vector graphics.
Regardless of the size of the figure on your screen, MATLAB saves a PDF file to a full letter-size (8.5×11 inches) sheet of paper. The size of the image on the sheet varies depending on the size of the figure window on your screen, but either way that will get printed to the center of a letter-size sheet of paper. This, quite simply, sucks. For people generating academic graphics, a vector format is the only acceptable way. While the problem does not exist when you MATLAB saves an EPS (Encapsulated PostScript, which is the other format of vector graphics that MATLAB recognizes), PDF is a much more convenient (and modern) format. Furthermore, MATLAB has a tough time saving any colors in EPS, and EPS files that are converted to PDF still have the problem with paper sizing. So while set_plot has a lot of features to make attractive graphics, its automatic control of the MATLAB parameter 'PaperSize' may be the most useful.