Why me? Matlab-LaTex stuff

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).

matlab

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.

Advertisements

9 Responses to “Why me? Matlab-LaTex stuff”


  1. 1 Alex Liberzon April 3, 2007 at 9:02 am

    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

  2. 2 ferramis April 8, 2007 at 8:11 am

    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.

  3. 3 Maarten November 21, 2007 at 5:48 pm

    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

  4. 4 Mike December 26, 2007 at 6:10 am

    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

  5. 6 Ceaser February 26, 2009 at 6:00 pm

    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

  6. 7 Gökhan October 21, 2010 at 12:16 pm

    I have exactly the same problem.


  1. 1 Waste of time « wAnNaBe NeRd Trackback on May 3, 2007 at 6:31 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




March 2007
M T W T F S S
« Feb   Apr »
 1234
567891011
12131415161718
19202122232425
262728293031  

Categories


%d bloggers like this: