I draw line charts showing price changes over time for several instruments using ggplot2. I managed to get some lines on the plot and add values showing the most recent price change. What I want to do (and have not yet reached) is to reorder the legend key so that the price series that has risen the most is at the top of the legend, and then the price series key that has risen to second place and and etc.
In the figure below, the legend shows the key in alphabetical order. What I would like to do is show the legend key entries in the order DDD, AAA, CCC, then BBB, which is the order of execution on the most recent date. How can i do this?

The following is the minimum code.
require(ggplot2)
require(scales)
require(gridExtra)
require(lubridate)
require(reshape)
set.seed(123)
monthsback <- 15
date <- as.Date(paste(year(now()), month(now()),"1", sep="-")) - months(monthsback)
mydf <- data.frame(mydate = seq(as.Date(date), by = "month", length.out = monthsback),
aaa = runif(monthsback, min = 600, max = 800),
bbb = runif(monthsback, min = 100, max = 200),
ccc = runif(monthsback, min = 1400, max = 2000),
ddd = runif(monthsback, min = 50, max = 120))
change_from_start <- function(x) {
(x - x[1]) / x[1]
}
mydf[, 2:5] <- lapply(mydf[, 2:5], function(myparam){change_from_start(myparam)})
myvals <- mydf[mydf$mydate == mydf$mydate[nrow(mydf)],]
myvals <- melt(myvals, id = c('mydate'))
p <- ggplot(data = mydf) +
geom_line( aes(x = mydate, y = aaa, colour = "AAA"), size = 1) +
geom_line( aes(x = mydate, y = bbb, colour = "BBB"), size = 1) +
geom_line( aes(x = mydate, y = ccc, colour = "CCC"), size = 1) +
geom_line( aes(x = mydate, y = ddd, colour = "DDD"), size = 1) +
scale_colour_manual("", values = c("AAA" = "red", "BBB" = "black", "CCC" = "blue", "DDD" = "green")) +
scale_y_continuous(label = percent_format()) +
geom_text(data = myvals, aes(x = mydate + 30, y = value, label = sprintf("%+1.1f%%", myvals$value * 100)), size = 4, colour = "grey50") +
opts(axis.title.y = theme_blank()) +
opts()
print(p)