Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How do I crop EPS output?
Replies: 4   Last Post: Apr 7, 2004 7:44 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jens Benecke

Posts: 10
Registered: 12/7/04
How do I crop EPS output?
Posted: Apr 6, 2004 11:26 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I use the following function after calling "plot" to print to PDF files to
include in PDFlatex documents, and for presentations using the 'beamer'

function topdf(basename, targetname, wfactor, hfactor)

if wfactor<2, wfactor=20; end
if hfactor<2, hfactor=20; end

u = 'centimeters'; set(gcf,'PaperUnits',u); set(gcf,'Units',u);
%pos = get(gcf,'pos'); width = pos(3); height = pos(4);
%set(gcf, 'PaperPosition', [1,1,width*wfactor,height*hfactor]);
set(gcf, 'PaperPosition', [1,1,wfactor,hfactor]);
print('-depsc2', '-tiff', [basename '.eps']);
system(['export P="$PWD" ; nohup sh -c "GS_OPTIONS=-dAutoRotatePages=/None
epstopdf ' basename '.eps ; cd ~/LATEX/pics ; ln -fs $P/' basename '.pdf '
targetname '.pdf ; cd - ; rm -v ' basename '.eps " &']);

However, when I use manual size (wfactor, hfactor above) Matlab adds a white
margin to the document at the left and right side. I would like to remove
those margins because I need the plots to align with the text in the

I tried editing the BoundingBox parameters in the EPS file before converting
them to PDF. This works. But it is manual trial-and-error work and not very
practical (especially because the plots are being updated all the time and
there's a LOT of them).

Any ideas would be most welcome!

Jens Benecke (jens at spamfreemail.de)
http://www.hitchhikers.de - Europaweite kostenlose Mitfahrzentrale
http://www.spamfreemail.de - 100% saubere Postfächer - garantiert!
http://www.rb-hosting.de - PHP ab 9? - SSH ab 19? - günstiger Traffic
Please DO NOT CC: me, I read the lists and newsgroups I post in!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.