ggplot-更改栏之间的空格

时间:2018-04-18 05:53:16

标签: r ggplot2 spacing

我确信它是一个基本的,但经过广泛搜索后找不到。

No  Status  Val Duration
I1  IS      New 1
I1  IS      InP 2
I1  IS      Re  3
I1  IS      Clo 4
I2  IS      New 20
I2  IS      InP 50
I2  IS      Re  20
I2  IS      Clo 5
I3  IS      New 3
I3  IS      Inp 8
I3  IS      Re  2
I3  IS      Clo 6 

ggplot(df,aes(x = No, y = Duration,fill=Val)) + 
geom_bar(position = position_fill(),stat = "identity",width=0.09) +
  scale_y_continuous(labels = percent_format())

如何减少我使用躲避它的拆除和并排设置的条之间的间距

enter image description here

1 个答案:

答案 0 :(得分:1)

调整宽度。

    ggplot(df,aes(x = No, y = Duration,fill=Val)) +  
    geom_bar(position = position_fill(),stat = "identity") 

正如您所看到的,在这种情况下,我从原始代码中删除了width参数。

<强>结果 enter image description here