多边形命令的透明度 [英] Transparency with polygon command

查看:85
本文介绍了多边形命令的透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在R中使用了polygon命令,该命令在绘图中创建了一个区域.但是,此区域中的值未显示,而主要目的是监视这些值.有人知道如何处理吗?

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?

推荐答案

您可以使用函数rgb()指定具有alpha透明性的颜色.

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

例如:

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)

这篇关于多边形命令的透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆