具有透明背景的 R plot 图例

R plot legend with transparent background

如何在使用 plot() 函数时绘制具有透明背景的图例?

使用:bg="transparent"

legend()

如:

legend("right",bg="transparent",col=c(as.numeric(unique(df$group2))),cex=0.5)