经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
how to have the effect of density=55 and 45 from hist() in the filled box in the legend? Thanks!
- x1 <- rnorm(100)
- x2 <- rnorm(100, 2)
- hist(x1, main = "", col = "orange",ylab = "density", xlab = "x", freq
- = F, density = 55, xlim = c(-2, 5), ylim = c(0, 0.5))
- par(new = T)
- hist(x2, main = "", col = "green", ylab = "", xlab = "",axes = F, xlim
- = c(-2, 5), ylim = c(0, 0.5), density = 45, freq = F)
- abline(v = mean(x1), col = "orange", lty = 2, lwd = 2.5)
- abline(v = mean(x2), col = "green", lty = 2, lwd = 2.5)
- legend(3, 0.45, legend = c("x1", "x2", "mean(x1)", "mean(x2)"),
- col = rep(c("orange", "green"), 2), pch=c(15,15, NA, NA),
- pt.cex=2,
- lty = c(0, 0, 2, 2))
复制代码
扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|