[R] gray background on jpegs using dev.print()

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 1 19:18:33 CEST 2004

> par(bg="white")
> plot(1:10)
> dev.print(jpeg, width=600, height=600)

gives a white background on the jpeg copy.  Without the first line it is a
transparent background, and the default matte for JPEGS is grey74, so the
viewer displays it as transparent over a grey matte.

BTW, John Muller has given an address that does not accept email without
jumping through loops replying to HTML mail.  Can we please add to the
Posting Guide the requirement that a usable return address is supplied?

On Thu, 1 Apr 2004, Prof Brian Ripley wrote:

> On Thu, 1 Apr 2004, John Muller wrote:
> > When I try writing the current device to a jpeg file I keep getting a
> > gray background for the jpeg images using dev.print.
> That's because you are not using the correct tool.  dev.print is designed 
> for printing, as it says.
> > I have tried using the option bg="white" and bg="#FFFFFF"
> > but neither seem to have any effect.
> Where?  Is what you are copying on a transparent background (the default)?
> > If instead of writing to a screen device I open a jpeg device I can get any background color
> > I want.  This works, but I prefer to write to the screen and then 
> > output to file if I like the results rather than to a file and have to view the jpegs
> > to see results.
> > 
> > I am using R version 1.8.1 on Windows 2000.
> > 
> > Has anyone else had this problem?
> What problem, exactly ...?  Please do read the posting guide and supply 
> enough details for us to reproduce this.
> And why if you are using Windows *are* you using dev.print when you are 
> not printing and there are menus and savePlot to copy a plot to a jpeg 
> file?

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list