【发布时间】:2014-02-11 11:31:16
【问题描述】:
我不知道我错过了什么,但我无法弄清楚一个非常简单的任务。这是我数据框的一小部分:
dput(df)
structure(list(ID = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), .Label = "SOU55", class = "factor"), Depth = c(2L, 4L,
6L, 8L, 10L, 12L, 14L, 16L, 18L, 20L), Value = c(211.8329815,
278.9603866, 255.6111086, 212.6163368, 193.7281895, 200.9584658,
160.9289157, 192.0664419, 174.5951019, 7.162682425)), .Names = c("ID",
"Depth", "Value"), class = "data.frame", row.names = c(NA, -10L
))
我想要做的只是用 ggplot 绘制深度与值,这是简单的代码:
ggplot(df, aes(Value, Depth))+
geom_point()+
geom_line()
结果如下:
但这与我真正想要的完全不同。这是使用 Libreoffice 制作的情节:
似乎 ggplot 没有正确链接这些值。我做错了什么?
谢谢大家!
【问题讨论】:
-
错误
geom。只需改用geom_path()。