【发布时间】:2014-10-15 04:33:02
【问题描述】:
我正在尝试在 ggplot2 中制作甘特图。我在更改 geom_segment() 中每个段的颜色和间距时遇到了麻烦
> head(g672)
mobility start endtime
1 active 0.00000 1.60157
3 active 1.60157 59.65837
5 active 59.65840 68.93415
7 immobile 68.93420 69.03430
9 active 69.03430 77.87629
11 immobile 77.87620 80.27855
我正在使用 geom_segment() 来生成图表:
ggplot(g672, aes(colour=mobility)) +
geom_segment(aes(x=start, xend=endtime, y=mobility, yend=mobility), size=15) +
xlab("Duration") +
theme_classic()
生成此图表:
我希望能够做 2 件事:1) 更改颜色和 2) 使 2 个条看起来彼此更接近,甚至让它们重叠(这些是相互排斥的类别,所以如果你是不做一个,你做另一个)。
欢呼并感谢您的任何建议
【问题讨论】:
标签: r colors ggplot2 gantt-chart