我有这些数据:
dt1 <- structure(list(yr = 2004:2010, X = c(0.637, 0.9701, 0.701, 0.4535, 0.5058, 0.4698, 0.6228), lower = c(0.4254, 0.6442, 0.4699, 0.2929, 0.3311, 0.3213, 0.4276), upper = c(0.8614, 1.32, 0.955, 0.6261, 0.6901, 0.6276, 0.8385)), .Names = c("yr", "X", "lower", "upper"), row.names = 50:56, class = "data.frame")
dt2 <- structure(list(yr = 2004:2010, X = c(0.1753, 0.2872, 0.3038, 0.1994, 0.2486, 0.235, 0.2604), lower = c(0.1059, 0.1747, 0.1879, 0.1174, 0.1542, 0.1507, 0.1704), upper = c(0.2554, 0.4121, 0.4319, 0.2876, 0.3542, 0.3222, 0.3588)), .Names = c("yr", "X", "lower", "upper"), row.names = 8:14, class = "data.frame")
我可以像这样使用ggplot:
ggplot(dt1, aes(x=yr, y=X, group=1, ymin = lower, ymax = upper)) +
geom_ribbon(alpha = 0.2) +
geom_line() +
geom_point(shape=21, size=3, fill="blue") +
theme_gray(12) +
opts(panel.background = theme_rect(fill='grey80')) +
ylim(0,1.7)
...对于 dt2 也是如此:
现在我想在同一张图上显示两个图。我怎样才能做到这一点 ?