library(RColorBrewer) plotMentions <- function () { yrange <- c(0,1.1*range(mentions[,-1])[2]) xrange <- c(1,length(mentions[[1]])) plot(xrange, yrange, type="n", xlab="November, 2014", ylab="Mentions per day") colors <- brewer.pal(length(mentions)-1, "Dark2") for (i in 2:length(mentions)) { lines(x=1:length(mentions[[1]]), y=mentions[[i]], col=colors[i-1], lwd=3) } title("Twitter Mentions by Network") legend(xrange[2]/2, yrange[2], names(mentions)[-1], cex=0.8, col=colors, lty=1, lwd=2, title="Network") }