Since yesterday I am desperately trying to solve a Matlab-LaTex issue, which makes me crazy. This post is only for those nerds out there which dream about Matlab and LaTex instead of chocolate cakes. So here is my problem:

I have a huge datafile, which I visualize via surf in Matlab. It looks colorful, meaningful and hence worth saving as an EPS file for later changes in LaTex via the psfrag package. This works usually very smooth and creates beatiful results. Now, however, due to the huge amount of data in the Matlab image (right one below), the saved EPS file is somewhere between 20-100 MB (!!) and furthermore LaTex doesn’t open it for psfrag. The first thing I did was use a renderer like zbuffer or painters in Matlab and also skip some percentage of the data, which reduced the file size sometimes, but not always (??). I was even able to open the files in LaTex, but psfrag didn’t access the labels in those figures. And sometimes LaTex was even able to acces the labels via psfrag, but then the image had the traces of the grid I used (the white lines in the left image).

I don’t know what to try else. I could of course save the image as JPEG or PDF or whatever and then convert it to an eps figure, than, however, I can’t use psfrag to access the information saved in the images. Another way would be to use the PDF or JPEG images and use a grafic program to insert labels, which than, after saving it as an EPS file, could be accessed by Latex via psfrag. That, however, I will not do, because I have a bunch of pictures, which I wanna have as I want them and I do not compromise. Not in matters of sweets or useless littlenesses like the mentioned here. Another way would be to access the information in JPEG images via imread and than filter the labels out and plot them again via the image command, but all that is not the proper way to solve this problem. There must be a simple way to just save a figure as an EPS file and access it via psfrag in LaTex regardless the huge amount of data in the figure.

This weekend will probably be devoted to this problem and I will probably get extremely angry if some baby wants to but his needs infront of this littleness. So I had to post this in the hope of some smart nerd out there who might just have the smartest way to solve it and hence save my weekend.

PS: For those who wonder what the figure with the strange labels show: It is the Cross-spectra of the streamwise velocity and passive scalar fluctuation across a heated jet at 5 nozzle diameters downstream. The labels are of course not set, but therefore I need psfrag, because Matlab labels just don’t look good enough for my eyes.

want a real advise? move to NumPy/SciPy/Matplotlib. http://www.scipy.org/SciPy

there are also other packages that will let you to move smoothly: mlabwrap (use Matlab from your Python programs http://mlabwrap.sourceforge.net/) and the opposite one (Python from Matlab, forgot it’s name).

see also

http://ipython.scipy.org/

http://pyx.sourceforge.net/

http://www.scipy.org/NumPy_for_Matlab_Users

Thanks for the advise. I downloaded it and tried to do something, but it seems I need a lot of time to get used to it. I will keep it in mind for the case that I get very bored, because I have to read the manuals I guess :). But for the time beeing I am too lazy to change from Matlab . But it is nice to have free of charge alternatives.

Hello!

I have exactly the same problem! psfrag doesn’t work and the eps-images have the traces of the grid.

Can somebody help?

Greetz

Hello,

Yes, I am also curious if you ever solved this. I am getting the same problem with the painters renderer but it is the only one that does vector output.

Thanks,

Mike

Thanks!,

Hi!

Btw, I think the grid problem might due to Mac OS X Preview viewer. For example, by opening the files with Adobe Illustrator the grid “disappears”…dunno which view is the “true one” though.

Thanks,

Cesare

I have exactly the same problem.

I think it has something to do with the way matlab

saves 3d figures. You don’t have the problem with 2d figures at all.