我在R
画了一个情节。
plot(NA,xlim=c(0,1),ylim=c(0,1), xlab=expression(delta),ylab="K", xaxs="i",yaxs="i",main = "Zones of extreme equality and inequality in BO1") # Empty plot
cols <- c("red","black")
legend("topright",legend=c("Gini < 0.05","Gini > 0.6"), density=c(NA,NA), angle=c(NA,NA), col=cols)
图例中的框未变色。这有什么不对?
答案 0 :(得分:10)
尝试使用pch
:
legend("topright",
legend=c("Gini < 0.05","Gini > 0.6"),
pch=15,
col=cols)
答案 1 :(得分:4)
你也可以把颜色放在填充中:
legend("topright",legend=c("Gini < 0.05","Gini > 0.6"), fill=cols)
答案 2 :(得分:2)
也许你这样试试:
legend("topright",legend=c("Gini < 0.05","Gini > 0.6"), pch=15, col=cols)