R 使用ggplot的直方图断点

R 使用ggplot的直方图断点,r,ggplot2,histogram,R,Ggplot2,Histogram,对于x轴形式-5到5的范围,如何以0.5的间隔增加x轴的断点 使用scale\u x\u continuous:+scale\u x\u continuous(breaks=seq(-5,5,by=0.5))@Heroka.如果我只想在x轴上用-2到2的值进行绘图,并用0.01进行打断,我尝试了scale\u x\u continuous(breaks=seq(-2,2,by=0.01))。但是情节越来越拥挤了,我知道。有没有其他的方法来规划?你想实现什么?你为什么要这么多记号?赫罗卡,我是这样

对于x轴形式-5到5的范围,如何以0.5的间隔增加x轴的断点


使用scale\u x\u continuous:
+scale\u x\u continuous(breaks=seq(-5,5,by=0.5))

@Heroka.如果我只想在x轴上用-2到2的值进行绘图,并用0.01进行打断,我尝试了scale\u x\u continuous(breaks=seq(-2,2,by=0.01))。但是情节越来越拥挤了,我知道。有没有其他的方法来规划?你想实现什么?你为什么要这么多记号?赫罗卡,我是这样试的。历史(res1$seg.mean,xlim=c(-2,2),中断=5000)。我想通过查看distribution@Kryo,听起来您想增加直方图存储箱的数量?在ggplot2中,这是通过
geom\u直方图(binwidth=0.0008)
完成的
binwidth
的单位与数据相同,因此-2-2=4;4 / 5000 = 0.0008.
ggplot(df1, aes(x= seg.mean)) +
    geom_histogram(binwidth=.6, colour="black", fill="white") 
    geom_vline(aes(xintercept=mean(seg.mean, na.rm=T)),  
    color="red", linetype="dashed", size=0.5)