R 图例符号的着色规则

R 图例符号的着色规则,r,plot,R,Plot,我想知道我怎么能有一个我的图例符号(正方形)根据调整颜色(“蓝色”,alpha.f=0.05)进行着色 我正在尝试下面的R代码(没有成功): 尝试此操作并根据需要进行修改。我制作了alpha.f=.5以使颜色更清晰(0.05很难感知),并添加了cex=1.5以放大所有内容以显示更清晰的颜色 curve(dt(x,19),-5,5) legend("topright",legend=c(expression(paste("Power")),expression(paste(beta))),

我想知道我怎么能有一个我的图例符号(正方形)根据
调整颜色(“蓝色”,alpha.f=0.05)
进行着色

我正在尝试下面的R代码(没有成功):


尝试此操作并根据需要进行修改。我制作了
alpha.f=.5
以使颜色更清晰(
0.05
很难感知),并添加了
cex=1.5
以放大所有内容以显示更清晰的颜色

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

legend("topright",legend=c(expression(paste("Power")),expression(paste(beta))),
       ,fill=c(adjustcolor("blue",alpha.f=.5),"white"),density=c(NA,NA),angle=c(NA,NA), bg = NA, cex = 1.5)

legend("topright",legend=c(expression(paste("Power")),expression(paste(beta))),
       ,fill=c("black","white"),density=c(15,NA),angle=c(140,NA), bg = NA, cex =1.5)
curve(dt(x,19),-5,5)

legend("topright",legend=c(expression(paste("Power")),expression(paste(beta))),
       ,fill=c(adjustcolor("blue",alpha.f=.5),"white"),density=c(NA,NA),angle=c(NA,NA), bg = NA, cex = 1.5)

legend("topright",legend=c(expression(paste("Power")),expression(paste(beta))),
       ,fill=c("black","white"),density=c(15,NA),angle=c(140,NA), bg = NA, cex =1.5)