[R] polygon is not filled by color with alpha when outside of plot region

Jinsong Zhao j@zh@o @end|ng |rom ye@h@net
Thu Oct 21 10:54:53 CEST 2021


Hi there,

Here is the codes that could demo the problem:

# work as expected
plot(1:5)
polygon(c(1.5, 6.5, 6.5, 1.5), c(1.5, 1.5, 6.5, 6.5), col = "gray")

# the polygon at right upper is not filled by gray with alpha = 0.5
plot(1:5)
polygon(c(1.5, 6.5, 6.5, 1.5), c(1.5, 1.5, 6.5, 6.5), col = 
adjustcolor("gray", 0.5))

# however, colors with alpha = 0.5 could be used with polygon
polygon(c(1.5, 5.0, 5.0, 1.5), c(1.5, 1.5, 5.0, 5.0), col = 
adjustcolor("gray", 0.5))

If the polygon is in the plot region(?) wholly, color with alpha works.

Is it designed?

 > R.version
                _
platform       x86_64-w64-mingw32
arch           x86_64
os             mingw32
system         x86_64, mingw32
status
major          4
minor          1.1
year           2021
month          08
day            10
svn rev        80725
language       R
version.string R version 4.1.1 (2021-08-10)
nickname       Kick Things

Best,
Jinsong



More information about the R-help mailing list