How to best include Matlab figure with transparency in a LaTeX document?

41 views (last 30 days)
Usually, the recommended way to include figures in LaTeX is via eps as discussed in This has the big advantage that eps stores the bounding boxes so that LaTeX will crop the figure automatically to remove whitespace.
But now I have a figure with alpha transparency and such transparency is not supported by eps. Of course I could export the figure into a PDF, but then I have to manually crop it before including it in LaTeX. So is there a better pipeline available?

Accepted Answer

Subhadeep Koley
Subhadeep Koley on 3 Sep 2019
In MATLAB R2019a you can save EPS with alpha transparency.
print('yourTransparentImage','-depsc');% place this code after the figure generation code
Find the attached zip file having transparent EPS file generated using this code. Also see the attached PDF with transparent EPS generated by LaTeX.
Otherwise, you can find a custom function to exports figures to a number of vector & bitmap formats here.
Jonas on 6 Feb 2023
did you find a solution? still cant export to eps using exportgraphics

Sign in to comment.

More Answers (0)


Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!