我确信有一种更优雅的方法可以做到这一点,但你可以试试这个:
Data <- data.frame(serie1 = cumsum(rnorm(100)), serie2 = rnorm(100), temps = as.Date(1:100, origin = "2000-01-01"))
label <- c("In traffic [max 2.0G bps] [Avg 1.1G bps] [95% 1.8G bps] [Min 569.4M bps]", "Out traffic [max 2.0G bps] [Avg 672M bps] [95% 2.1G bps] [Min 154.3M bps]")
p <- ggplot(melt(Data, id = "temps"), aes(temps, value, group = variable, colour = variable))
p <- p + geom_line() +xlab("") + opts(legend.position = "bottom", legend.title = NULL)
p <- p + scale_colour_manual(values = c("red", "blue"), breaks = c("serie1", "serie2"), labels = label)
print(p)