Transparency with polygon command

徘徊边缘 提交于 2019-12-03 11:17:33

问题


I used the polygon command in R which created an area in the plot. However, the values in this area are not shown whereas the main aim is to monitor these values. Does anyone know how to handle this?


回答1:


You can use The function rgb() to specify a color with an alpha transparency.

for example :

xx <- c(1:50)
 yy <- rnorm(50)
 n <- 50
 hline <- 0
plot (yy ~ xx, type="n", axes=FALSE, ann=FALSE)
text(x=xx,y=min(yy)+max(yy),labels='a')
polygon(c(xx[1], xx, xx[n]), c(min(yy), yy, min(yy)),    
        col=rgb(1, 0, 0,0.5), border=NA)



来源:https://stackoverflow.com/questions/14099833/transparency-with-polygon-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!