【发布时间】:2014-10-20 19:30:05
【问题描述】:
上下文:我想代表一个过程的旅程。
样本数据:
____________________________________________________________________
| Time | ProcessNo (factor) | ProcessName (factor) |
+------------------+------------------------+------------------------+
| 2014-08-01 | 1 | Brainstorming |
| 2014-08-03 | 2 | Estimation |
| 2014-08-04 | 1 | Brainstorming |
| 2014-08-09 | 3 | Construction |
| 2014-08-14 | 4 | Rectifying |
+--------------------------------------------------------------------+
我使用 ggplot2 绘制了一个绘图,其中 x = Time,y = ProcessName。
p <- ggplot(dfCheckpoints, aes(Time, ProcessName))
p <- p + geom_point()
问题:我想覆盖一条线,按时间顺序连接进程。如果有任何帮助,ProcessNo 只是 ProcessName 变量的因子级别。
我尝试添加一个新行:
p <- p + geom_line(data = dfCheckpoints, aes(x = Time, y = ProcessNo))
但它在 Y 轴上增加了额外的因素。
如果有其他方法,我也很乐意尝试。
提前致谢!
【问题讨论】:
-
dput(dfCheckpoints)会很有帮助的。
标签: r ggplot2 scatter-plot