# NOT RUN {
# See examples in help(ga)
# The following code shows how to obtain graphs using the 
# ggplot2 plotting system 
# }
# NOT RUN {
GA <- ga(...)
out <- plot(GA)
library(reshape2)
df <- melt(out[,c(1:3,5)], id.var = "iter")
library(ggplot2)
ggplot(df, aes(x = iter, y = value, group = variable, colour = variable)) +
  xlab("Generation") +  ylab("Fitness values") +
  geom_point(aes(shape = variable)) + 
  geom_line(aes(lty = variable)) +
  scale_colour_brewer(palette = "Set1") +
  theme_bw() +
  theme(legend.title = element_blank())
# }
Run the code above in your browser using DataLab