5.0

5.0 | 1 rating Rate this file 445 downloads (last 30 days) File Size: 6.72 KB File ID: #22267

print_eps

by Oliver Woodford

 

28 Nov 2008 (Updated 15 Dec 2008)

Save figures to high quality eps files with cropped borders and embedded fonts.

Download Now | Watch this File

File Information
Description

PRINT_EPS saves a figure to an eps file, with:  
   - Figure borders cropped  
   - Fonts embedded (as subsets)  
   - Accurate vector graphics, compressed losslessly  
   - High quality bitmap graphics, compressed lossily  
   - Line dash lengths vary with line width (as on screen)  
   - Grid lines given their own dot style, instead of dashed  
   - No options to be set  
   
PRINT_EPS requires only a target filename and an optional figure handle - there are no other options to be set. The output eps is exactly the size and layout of the figure on the screen. Additionally, line styles for dotted and dashed lines are improved for clarity, along with grid lines, resembling better those in the original figure. The function is perfect for generating eps figures for use in scientific publications.  
   
PRINT_EPS uses ghostscript and pdftops (from the Xpdf package), so these must be installed on your system and the executables must be on your system's path. Get them from -  
Ghostscript: http://www.ghostscript.com  
Xpdf: http://www.foolabs.com/xpdf

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
savefig

MATLAB release MATLAB 7.5 (R2007b)
Other requirements Ghostscript, Xpdf
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
14 Dec 2008 Liang Li Hey, 
 
Thanks a lot for this function. This is exactly what I am looking for. However, I am using a window XP system and this function doesn't seem to work right. I guess it is because I did not make pdftops work right in win32. I went to the Xpdf website you mentioned above, download the precompiled binary package: Win32 (built with MSVC): xpdf-3.02pl2-win32.zip. I changed the directory in your function. However, system(cmd) returns a result of 1. Would you please give me some hints on what I should do? or it is just not for windows users? 
 
Many thanks, 
 
Liang
15 Dec 2008 Oliver Woodford The function is written to work on all systems. I have used it on a Windows Vista system without any trouble.
16 Dec 2008 stone li Would you please give me some hints about how to install the ghostscript and pdftops and set path for the compiler?
17 Dec 2008 Oliver Woodford For Windows, download gs###w32.exe (where ### is a number, e.g. 863) from Sourceforge (follow the link at ghostscript.com), and extract it to the default location. Download the zip file named Xpdf-#.##pl2-win32.zip from http://www.foolabs.com/xpdf/download.html and extract the files in it to the folder 
C:\Program Files\gs\gs#.##\bin (where #.## is a number) where Ghostscript was installed. Now put this folder on your system path, by following instructions at: 
http://windowsitpro.com/article/articleid/48074/how-can-i-add-a-new-folder-to-my-system-path.html
Please login to add a comment or rating.
Updates
01 Dec 2008 Avoid changing figure position units
11 Dec 2008 Fix line styles to look more like those on screen
11 Dec 2008 Fix line styles, and set grid lines to a different style from dotted lines
11 Dec 2008 Improve finding of grid lines to update line style
12 Dec 2008 Change dash length with line width
15 Dec 2008 Improved line styles for thinner lines

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com