图例:填充颜色R图的变化

时间:2017-01-11 04:02:10

标签: r plot

我想知道如何在图例中更改测试版旁边的正方形填充颜色 根据:adjustcolor("blue",alpha.f=0.05)

这是我的当前R代码(没有成功):

curve(dt(x,19),-5,5)

legend("topright",legend=c(expression(paste("Power")),expression(paste(beta))),
density=c(15,0),angle=140,fill=T,col=c(adjustcolor("blue",alpha.f=0.05),0))

1 个答案:

答案 0 :(得分:1)

这样的事情应该有效:

legend("topright",legend=c(expression(paste("Power")),expression(paste(beta))),
       density=c(15,0),angle=140,fill=T,border=c('black', 'blue'))

enter image description here

<强> [EDITED]

legend("topright",legend=c(expression(paste("Power")),expression(paste(beta))),
       density=c(15,NA),angle=140,fill=c("#000000FF", adjustcolor("blue",alpha.f=0.5)),
       border=c("#000000FF", adjustcolor("blue",alpha.f=0.5)))

enter image description here