如何在图片内手动添加图例。我试图在网上找到答案,但未能找到合适的答案。请指教。如何用ggplot2手动添加图例
感谢您的帮助提前。
p = ggplot(gData, aes(seq, mue)) + geom_line(aes(x = seq, y = mue), lty=1, lwd=1) + xlim(-10, 10) + ylim(-1.0, 1.0) +
xlab(expression(paste(u[t-1],sep = ""))) + ylab(expression(paste(mu[t],""))) +
geom_line(aes(x = seq, y = se1), type="b", lty=2, lwd=1.1) + geom_line(aes(x = seq, y = se2), type="b", lty=2, lwd=1.1) +
theme(axis.title.x = element_text(face = "bold", color = "black", size = 14),
axis.title.y = element_text(face = "bold", color = "black", size = 14))
不知道如果我的理解正是你正在尝试做的,但你可以调整与'主题'legend.position'参数图例的位置()'函数,例如'主题(legend.position = “顶部”)'。该函数也可以将坐标作为参数。看到这里(http://www.cookbook-r.com/Graphs/Legends_%28ggplot2%29/)了解如何改变'ggplot2'中的图例的一些例子。 – rseubert 2014-10-05 10:29:40