How to "Clean Up" a Matlab Figure with Adobe Illustrator
Overview
Basic process is as follows:
Generate figure in Matlab
Save figure to .eps format
Ensure that renderer is set to Painters
Open .eps figure with Illustrator
Save as .pdf for Latex or .png for MS Word
Generate Figure in Matlab
It will be time-consuming to "clean up" figures in Illustrator, so spend some time in Matlab to make your figure look close to how you want it.
Size, aspect ratio
Title, axis labels, grid on, box off
Axis limits
Line colors, line style, line width
Legend
Save Figure to .eps
You can always click file>save as .eps in the figure window.
You can also use saveas() function in Matlab, e.g., if you want to save a bunch of figures:
Matlab has multiple "renderers", which it uses to draw figures. The default is openGL. Sometimes, when you export a .eps using openGL, the result is bitmap-y. If you open it in illustrator, then we might need to change the renderer.
Default renderer can be changed with the command
Then resave the figure as .eps, and it should be editable in Illustrator.
Open .eps in Illustrator
Should see that figure is now made up of vectors. A couple weird things can happen.
Your lines may be a whole bunch of tiny, unrelated points, which makes it hard to edit. Sometimes (I don't know why), lines are a "compound path" of many different points. Right click and "release compound path" to make it easier to edit.
The font helvetica is Matlab's default, but isn't supported by Illustrator. Might be good to change font to Arial in Matlab before saving .eps.
Change the artboard to be the size that you want the figure on the page. For Living Machines papers, this is 12 cm (4.72 inches) wide. For other journals, you may want to make a full-column (6.5 inches wide) or half-column (3.25 inches wide) figure.
Move things around, adjust font sizes, transparencies, and other features that are hard to fix in Matlab.
In general, we don't want to change "the data"; don't shift, resize, smooth the plots.
Save as .pdf
.pdf is also a vector format, which Latex uses directly. If you are using Latex, then this is the way to do it.
Your figure .pdf may be very large. If it's 1 MB or larger, then it is too big. It will be difficult to email the figures around, and if you have a bunch of these in your paper, it will make the paper huge (like 10+ MB). This happens because each trace is preserved in the .pdf. If you have 1,000 lines, the .pdf saves them all, even if they all overlap. The solution is to downsample your data in Matlab before saving the .eps, or to not plot so many lines within the same figure. If this is truly unavoidable, then you can "flatten" the image in Illustrator, which basically converts it to a bitmap (from what I understand).
Save .png for MS Office
Ensure high resolution (600 dpi is typical).
If necessary, make the artboard transparent for background-less figures (very classy).
Last updated