Exporting from MATLAB to eps
I had some trouble today trying to convert one mesh figure to an eps file to use it in LaTex. First the face color in the mesh wasn’t properly set when I exported, MATLAB create some annoying margin around the eps file and the margins were not as tight as possible.
Any way I found good information in the web. But I cannot finish my task automatically as I wanted. I will explain a little bit about how to publish a good figure in few steps.
First prepare your figure — do some plots –, and store the handler
h = figure(1);
Then, — it is supposed to work, or you can use another method — you set the margins tight
And for a good final look you need to set the background to other color that is different from the default gray
This part is important if you are trying to change the faces color in a 3D plot, if you don’t change this value the faces are not rendered properly.
Now let’s print the figure to an eps file using
-depsc2 driver and for a good result use a vector graphics output, using the painters render er
This should do the magic. Although, for me the margins wasn’t tight enough. I solve this problem by editing the eps file by hand. Open it with a text editor and change the lines (all of them)
%%BoundingBox: x-ll y-ll x-ur y-ur
x-llis the x-coordinate of the lower-left corner of the BoundingBox.
y-llis the y-coordinate of the lower-left corner of the BoundingBox.
x-uris the x-coordinate of the upper-right corner of the BoundingBox.
y-uris the y-coordinate of the upper-right corner of the BoundingBox.
That make good figures. You can change the size of the paper too, and other properties before printing.