我试图以与 R 默认情况下隔离带边框的箱线图相同的方式获得隔离条形图的相同效果。换句话说,我希望出现在下面第一个图中的边框出现在第二个图中:
par(mfrow=c(2,1))
## boxplot on a formula:
boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
# *add* notches (somewhat funny here):
boxplot(count ~ spray, data = InsectSprays,
notch = TRUE, add = TRUE, col = "blue")
require(grDevices) # for colours
tN <- table(Ni <- stats::rpois(100, lambda=5))
r <- barplot(tN, col=rainbow(20))
#- type = "h" plotting *is* 'bar'plot
lines(r, tN, type='h', col='red', lwd=2)