[R] Color of points in legend() ignored if plotting to PNG

Helmut Schuetz helmut.schuetz at bebac.at
Sun Feb 28 14:02:02 CET 2016

Dear all,

if I plot to a PNG, the color of filled points (pch 21:25) in legend() is ignored (i.e., only the background color is used). It does not matter whether I specify the default png(bg="white") or png(bg="transparent").

The example below

x <- rnorm(10)
y <- rnorm(10)
plot(x, y, pch = 21, cex = 1.5,
   xlim = range(x, y) * 1.2, ylim = range(x, y)*1.2,
   col = "black", bg = "lightgrey")
legend("topleft", legend = "foo", inset = 0.02,
   bg = "white", pch = 21, pt.cex = 1.5,
   col = "black", pt.bg = "lightgrey")

works as desired on windows(...) but fails to show the color in the legend on png(...).

Any suggestions?

Environment: x86_64-w64-mingw32/x64 (64-bit), R 3.2.3

Ing. Helmut Schuetz
BEBAC - Consultancy Services for
Bioequivalence and Bioavailability Studies
Neubaugasse 36/11
1070 Vienna, Austria
VAT No  ATU61115625
DUNS    300370568
tel     +43 1 2311746
mobile  +43 699 10792458
e-mail  helmut.schuetz at bebac.at
web     http://bebac.at/
contact http://bebac.at/Contact.htm
forum   http://forum.bebac.at/

This e-mail is confidential and may also be legally privileged. If you
are not the intended recipient please reply to sender, do not disclose
its contents to any person and delete the e-mail. Any unauthorized
review, use, disclosure, copying or distribution is strictly prohibited.

More information about the R-help mailing list