我有数据:
> dat
slopes sig
1 -1.24285 insignificant
2 0.01733 insignificant
3 -0.00050 insignificant
4 -0.06455 insignificant
5 0.00608 insignificant
6 0.01669 insignificant
7 -0.00751 insignificant
8 -0.00987 p <0.05
9 -0.00069 insignificant
10 0.00482 insignificant
11 -0.00446 insignificant
12 -0.00035 insignificant
13 -0.00205 insignificant
14 0.00585 insignificant
15 0.00507 insignificant
16 0.00002 insignificant
17 -0.00279 insignificant
18 -0.00580 p <0.05
19 0.00399 insignificant
20 -0.00647 p <0.05
21 -0.00268 insignificant
22 -0.00696 insignificant
23 -0.00678 insignificant
24 0.00034 insignificant
25 -0.00208 insignificant
26 -0.00012 insignificant
27 -0.00027 insignificant
28 0.00082 insignificant
29 0.01113 insignificant
30 -0.00171 insignificant
31 0.00134 insignificant
32 -0.14532 insignificant
33 -0.00433 insignificant
34 0.00440 insignificant
35 0.00369 insignificant
36 -0.00063 insignificant
37 0.01138 insignificant
38 0.00323 insignificant
39 -0.03902 p <0.05
我试图使用以下代码在ggplot2中绘制堆积直方图:
ggplot(dat,aes(x=slopes,fill=sig))+
labs(title='Log(Biomass+1)') +
geom_histogram(data=dat,position='stack',aes(x=slopes),color='black',binwidth=diff(range(dat$slopes))/20)+ # without change.
scale_fill_manual(values=c('darkgray','pink'),name='Significance') +
labs(x='Slope', y='Frequency', size=20) +
theme(axis.text = element_text(size = rel(1.5)),
axis.title = element_text(size = rel(1.25)),
plot.title = element_text(size = rel(2))) +
scale_y_continuous(expand=c(0,0), limits=c(0,10))+
theme_bw()
但并非所有数据都被绘制。事实上,我的结果是:
如何让直方图显示所有数据?