这是数据:
myd <- data.frame (X1 = rep (c("A0001", "B0002", "C0003", "D0004"), each = 2),
X2 = rep (c(1, 5.3, 8.2, 12.5), each = 2), X3 = rep (c("A", "B"), 4),
Y = rnorm (8, 5, 2))
这是我可以绘制的情节:
require(ggplot2)
ggplot(myd, aes(x = X2, y = Y, group = X3)) +
geom_point (aes(col = X3, pch = X3)) + geom_line (aes(col = X3))
除了 X2 值之外,我还希望 X1 文本到 x 轴上的相应位置。干草稿:
我该怎么做 ?编辑:
注意:目的是在X轴上同时显示连续的刻度和文本: