简体   繁体   中英

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

Here is my current R code (with no success):

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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