我有一个像
这样的变量的直方图aa=-(a$mmag)/2.5
hist(10^(aa),breaks=40,xlab=expression(paste(mu)),ylab=NA)
如何在两者之间漫射垂直线?
答案 0 :(得分:3)
这是我能想到的唯一解决方案:
hist(rnorm(1000), col = "grey", border = "grey")
基本上我们将线条颜色(border
)和填充颜色(col
)设置为相同。不要尝试设置“白色”;你什么也看不见。
答案 1 :(得分:0)
这是一个应该完成它的功能......随意编辑!
empty_hist <- function(x,...) {
histo <- hist(x,plot=F)
plot(NA,xlim=c(min(histo$breaks),max(histo$breaks)),ylim=c(0,max(histo$counts)),xlab="",ylab="count",...=...)
segments(x0=histo$breaks[1:(length(histo$breaks)-1)],x1=histo$breaks[2:length(histo$breaks)],y0=histo$counts,y1=histo$counts)
segments(x0=histo$breaks[2:(length(histo$breaks)-1)],x1=histo$breaks[2:(length(histo$breaks)-1)],y0=histo$counts[1:(length(histo$counts)-1)],y1=histo$counts[2:(length(histo$counts))])
segments(x0=histo$breaks[c(1,length(histo$breaks))],x1=histo$breaks[c(1,length(histo$breaks))],y0=c(0,0),y1=histo$counts[c(1,length(histo$counts))])
abline(h=0)
}
x <- rnorm(100)
empty_hist(x, main="here's a title")