Re: [R] Crop white border for PDF output

2005-11-24 Thread Stephen Eglen
Claus Atzenbeck writes:
  On Tue, 22 Nov 2005, Marc Schwartz wrote:

  The disadvantage with pdfcrop is that it takes an additional step:
  First, I have to produce the diagrams, then, I have to call pdfcrop on
  them to crop the white space. pdfcrop does a perfect job here: It crops
  the complete white space around a diagram automatically without having
  me to name some concrete numbers. It would be very nice if R would have
  an option that would allow to do me to do this for graphics that will be
  included in documents later.

Does pdfcrop take input from stdin?  I normally have a similar problem
when making postscript files.  Rather than worry about the excess size
of the border, I do the following:

  postscript(file=|psfbb w81s1_m623.ps,
 width=7, height=4, onefile=FALSE, horiz=F)
  plot ...
  dev.off()

Where my script, psfbb, crops to a tight bounding box.  Maybe
you could try 

  pdf(file='|pdfcrop  yourfile.pdf')
  ...
  dev.off()


My script, psfbb, is available from:
  http://www.damtp.cam.ac.uk/user/sje30/postscript/psfbb

Stephen

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Crop white border for PDF output

2005-11-22 Thread Florence Combes
Dear Claus,

I had not exactly the same pb, but close enough to propose you to take a
look at the options fin and fig in the par() function.

Hope this helps.

Florence.



On 11/19/05, Claus Atzenbeck [EMAIL PROTECTED] wrote:

 Hi,

 I produce a series of diagrams with R in order to include them in my
 documents (LaTeX). However, there is a white border around the diagrams.
 For some that do not have anything written at the very bottom, the white
 border is relatively large. The rather big space between figure and
 caption at the final document looks not nice.

 It would be best not to have any white border. I played with
 oma=c(0,0,0,0) and mar=c(0,0,0,0) for single and multiple figure
 environments, however, without success.

 Is there an easy way to get rid of the white border for PDF outputs?

 Thanks for your input.
 Claus

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Crop white border for PDF output

2005-11-22 Thread Claus Atzenbeck
On Tue, 22 Nov 2005, Florence Combes wrote:

 I had not exactly the same pb, but close enough to propose you to take a
 look at the options fin and fig in the par() function.

Thanks for your answer. In the meanwhile I also found another solution.
I produce diagrams as usual and use pdfcrop to crop them afterwards. It
takes two steps, but that's also OK.

Claus

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Crop white border for PDF output

2005-11-22 Thread Marc Schwartz
On Tue, 2005-11-22 at 10:48 +0100, Claus Atzenbeck wrote:
 On Tue, 22 Nov 2005, Florence Combes wrote:
 
  I had not exactly the same pb, but close enough to propose you to take a
  look at the options fin and fig in the par() function.
 
 Thanks for your answer. In the meanwhile I also found another solution.
 I produce diagrams as usual and use pdfcrop to crop them afterwards. It
 takes two steps, but that's also OK.
 
 Claus


Without your code, it is hard to know exactly what you need to resolve
the problem or why your manipulation of the margins did not work as you
want, but I am guessing that the following might be helpful.

Here is a default PDF plot:

 pdf(PDF1.pdf, height = 4, width = 4)
 barplot(1:5)
 dev.off()

 
Here is the same plot, but with the margins reduced:

 pdf(PDF2.pdf, height = 4, width = 4)
 par(mar = c(1, 3, 1, 1))
 barplot(1:5)
 dev.off()


Here is a default 2 x 2 plot:

 pdf(PDF3.pdf, height = 4, width = 4)
 par(mfrow = c(2, 2))
 barplot(1:5)
 barplot(1:5)
 barplot(1:5)
 barplot(1:5)
 dev.off()


Here is the same with reduced margins:

 pdf(PDF4.pdf, height = 4, width = 4)
 par(mfrow = c(2, 2))
 par(mar = c(1, 3, 1, 1))
 barplot(1:5)
 barplot(1:5)
 barplot(1:5)
 barplot(1:5)
 dev.off()



HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Crop white border for PDF output

2005-11-22 Thread Claus Atzenbeck
On Tue, 22 Nov 2005, Marc Schwartz wrote:

 Without your code, it is hard to know exactly what you need to resolve
 the problem or why your manipulation of the margins did not work as you
 want, but I am guessing that the following might be helpful.

The reason why the manipulation of margins does not make me happy is
that I have to name concrete numbers for every diagram.

Basically, it would be nice to tell R to produce PDF output without
*any* white border. It looks ugly when viewed directly, but it is
perfect when included in documents, where, e.g., TeX takes care of
spaces between diagrams an captions, etc.

Even your examples with the reduced borders still show a white border
around the diagram. It would take rather long to get rid of that by
using trial and error.

The disadvantage with pdfcrop is that it takes an additional step:
First, I have to produce the diagrams, then, I have to call pdfcrop on
them to crop the white space. pdfcrop does a perfect job here: It crops
the complete white space around a diagram automatically without having
me to name some concrete numbers. It would be very nice if R would have
an option that would allow to do me to do this for graphics that will be
included in documents later.

Claus

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Crop white border for PDF output

2005-11-19 Thread Claus Atzenbeck
Hi,

I produce a series of diagrams with R in order to include them in my
documents (LaTeX). However, there is a white border around the diagrams.
For some that do not have anything written at the very bottom, the white
border is relatively large. The rather big space between figure and
caption at the final document looks not nice.

It would be best not to have any white border. I played with
oma=c(0,0,0,0) and mar=c(0,0,0,0) for single and multiple figure
environments, however, without success.

Is there an easy way to get rid of the white border for PDF outputs?

Thanks for your input.
Claus

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html