Dear list,
I'm puzzled by the graphical output in the following example,
library(grid)
foo <- function(){
grid.rect(gp=gpar(fill="black"))
print(get.gpar()$fill)
grid.rect(width=0.2,height=0.2)
}
png("test.png", bg = "transparent")
foo()
dev.off()
png("test1.png", bg = "white")
foo()
dev.off()
It seems that the default value of gpar()$fill is set according to the
device background. I couldn't find this documented in ?gpar or in
?png, and it caused a rather puzzling bug in my code (the pdf() output
was OK, whilst the png output (default bg to white) was seemingly
empty because covered by a white rectangle.)
Best regards,
baptiste
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel