EPS figures from Matlab with transparent background for Latex

1,067 views
Skip to first unread message

Karthikeyan Nainar

unread,
Jan 18, 2011, 2:34:43 AM1/18/11
to latex...@googlegroups.com
When we export eps figures from Matlab,  white background is added to it. This makes the figure to look awkward if it is used in color Beamer template. So how to get a transparent background in a eps figure.
I got the answer from this web page

http://thedailyreviewer.com/compsys/view/exporting-matlab-figure-to-eps-without-background-109301075

All you have to do is the following
1) In matlab file add the commands to format your figure with transparent background
     set(gcf, 'color', 'none');
     set(gca, 'color', 'none');
 and save or export the figure generated in eps format. (say Bspline.eps)
2) Open Bspline.eps in NotePad
3) Look at the first line
   For example
 %!PS-Adobe-3.0 EPSF-3.0
The last number 3.0 indicates the Postscript level
For level 3
Search the string "rf".
You will find in one line like this (four numbers followed by "rf")
0    0 3025 2593 rf
Comment that line using %.
(For level 2 search for string "pr" instead of "rf")
Save the file.
Now you can use the eps file or you can convert it to pdf and then use it.
Anyway it will have transparent background

Amazing!!!

karthick
Reply all
Reply to author
Forward
0 new messages