Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. Data<-data.frame("Date"=as.Date(16200:16499),"Total"=rnorm(300,4500,50))
  2. Mean<-mean(Data$Total)
  3. SD1<-Mean-sd(Data$Total)
  4. SD2<-Mean+sd(Data$Total)
  5.  
  6. TotalDay <- ggplot(data = Data, aes(x=Date, y=Total,colour=Legend)) +
  7. geom_line(aes(y=Total, colour="Total Tweets"))
  8.  
  9. TotalDay + ggtitle("Tweets per Day") +labs(x="Date",y="Tweets") +
  10. theme(plot.title = element_text(color="#666666", face="bold", size=18, hjust=0)) +
  11. theme(axis.title = element_text(color="#666666", face="bold", size=13)) +
  12. geom_hline(aes(yintercept =Mean,colour="Mean")) +
  13. geom_hline(aes(yintercept =(SD1),
  14. colour="Standard Deviation"))+
  15. geom_hline(aes(yintercept =(SD2),
  16. colour="Standard Deviation"))
  17.  
  18. TotalDay + scale_color_manual(name="Legend",
  19. values=c("Total Tweets"="#f04546","Mean"="#3591d1","Standard Deviation"="#62c76b"))
  20.  
  21. library(stringr)
  22. library(dplyr)
  23. library(Ryacas)
  24. library(quantmod)
  25. library(data.table)
  26. library(tm)
  27. library(lubridate)
  28. library(ggplot2)
  29. library(extrafont)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement