[R] graphics backgrounds from gray to white in png()

Scot W McNary smcnary at charm.net
Mon Mar 10 18:48:11 CET 2003



Hi,

I'm trying to make a png file of a histogram.  I would like a white
background in the final product but end up producing a gray one, despite
setting what I think are the correct parameters.  Suggestions for how to
properly set a white background would be welcome.

Thanks in advance,

Scot


# for non-lattice
> par("bg"="white")
> par("bg")
[1] "white"

# for lattice
background<-trellis.par.get("background")
background$col<-"white"
trellis.par.set("background",background)

> trellis.par.get("background")
$col
[1] "white"

# produces gray background in png, but white when plotted in active device
> png(filename = "c:/windows/temp/test.png", width=480, height=640,
+ pointsize = 10, bg="white")
> histogram(rnorm(500))
> dev.off()
windows
      2

Vitals:

> R.version
         _
platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    1
minor    6.2
year     2003
month    01
day      10
language R


--
  Scot W. McNary  email:smcnary at charm.net



More information about the R-help mailing list