简体   繁体   English

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

[英]Legend: change of fill color R plot

I was wondering how I could change the fill color of the square next to beta in my legend below to be according to: adjustcolor("blue",alpha.f=0.05) ?我想知道如何将下面图例中beta旁边的正方形填充颜​​色更改为根据: adjustcolor("blue",alpha.f=0.05)

Here is my current R code (with no success):这是我当前的 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))

Something like this should work:这样的事情应该工作:

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

在此处输入图片说明

[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)))

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM