Here are some brief details and tips for developing a good workflow for generating publication-quality images.
As you become a more experienced researcher, you will learn the value of developing a workflow where images can be easily re-generated. This means that you can easily replot the images when you are finalising the presentation.
.mat
files. .mat
files and plot the data. This means if you ever need to regenerate pictures, you can do it very easily. If you are performing a numerical experiment, make sure to comment the filename or comment the file directly, indicating important clues about when the figure was generated, and the conditions..fig
files of the pictures. Again, it allows fine-tuning. (In fact, you can extract raw data from .fig
files via scripts if you look into it). To save such a file, simply click File > Save-As on the figure window.Traditionally (meaning literally in the last 20 years), Matlab has had very poor ability to generate publication-quality images. Problems include: poor bounding boxes, weird rasterisation effects, weird layering issues, etc.
Always, always, always whenever possible, export your images in PDF. This is currently the best format for including into LaTex. When done in the vectorised format of a PDF, the image is then scalable.
There are exceptions to the above rule in the context of images that are extremely data-hungry (thousands of points) or involve 3D surfaces, contour plots, etc. In those cases, the export to PDF can cause file sizes that are too large, or can cause weird layering effects (due to the complexity of rendering a surface, say). In those cases, you want to export to a rasterised format like PNG.
Use export_fig package (Matlab file exchange) to export to pdf format.
Once you have downloaded the export_fig
package, unzip it and move the folder into a unified functions folder on your computer. Refer to the startup.m guide. By doing so, you can issue a command like
export_fig 'test.pdf'
in order to produce a PDF of the currently focused figure.
In order to add annotations to figures, you have a few options:
More 'advanced' figure generation can involve things like TikZ, which generates figures natively within LaTeX. The advantage of this approach is consistency in annotation.
Post-2010 there have been very powerful scripts that allow Matlab figures to be automatically converted to TiKZ, such as matlab2tikz.
If you are an undergrad student or under pressure to write a report, I don't recommend trying to learn this!