[R] "transparent" background for PDF

Denis Chabot chabotd at globetrotter.net
Sat Mar 25 21:58:08 CET 2006

As far as I know, PowerPoint does not import pdfs. Without telling  
you it transforms it in a png. And it is not very smart about making  
a high res png at that. Maybe it is also not very clever about taking  
the transparent background into account?

When I must use PowerPoint, I either transform the pdf in png myself,  
or prepare the presentation in Keynote and export to PowerPoint  
format. This also translates the pdf figures into png figures, but at  
much better resolution than what PowerPoint does.

I tried making both pdf and png from my R program. I had hoped I  
would use the same settings for both devices (just copy and paste the  
plot instructions into a call for each device), unfortunately it did  
not work because to do better than PowerPoint's translation, I had to  
save the png version of my plots at high resolution, and that meant  
that all of the plot adjustments I made so that the pdf version  
looked nice (position of text, size of margins, etc) had to be fine- 
tuned differently for the png version, which was too time consuming...

Le 06-03-25 à 06:00, r-help-request at stat.math.ethz.ch a écrit :

> De : Dennis Fisher <fisher at plessthan.com>
> Date : 24 mars 2006 13:30:24 HNE
> À : r-help at stat.math.ethz.ch
> Objet : [R] "transparent" background for PDF
> Colleagues
> Running R2.2.1 on either a Linux (RedHat 9) or Mac (10.4) platform.
> I created a PDF document using pdf("FILENAME.pdf", bg="transparent",
> version="1.4").  I then imported the graphic into PowerPoint -
> background was set to a non-transparent color.  I was hoping that the
> inserted graphic would be transparent - instead, it had a white
> background.
> The help pages indicate:
>       The 'version' argument modifies the sort of PDF code that gets
>       produced.  At the moment this only concerns the production of
>       transparent output.  The version must be greater than 1.4 for
>       transparent output to be produced.  Specifying a lower version
>       number may be useful if you want to produce PDF output that  
> can be
>       viewed on older PDF viewers.
> The archives reveal the following:
>> From: Benno Ptz <puetz>
>> Date: Thu Nov 4 14:20:28 2004
>> Hello,
>> I have run across the following problem:
>> Creating PDF files manually by using
>> pdf(version=1.4)
>> I can make graphs using the new transparency feature of R2.0.
> Note that I used version 1.4.  Attempts to use larger numbers (1.5,
> 2.0, etc.) resulted in error messages:
> Error in pdf("FILENAME.pdf", bg = "transparent",  :
>          invalid PDF version
> I also attempted to address this with par(bg="transparent") without
> success.
> Does anybody have any ideas?
> Dennis
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-415-564-2220
> www.PLessThan.com

More information about the R-help mailing list