# Basic knitr options
library(knitr)
opts_chunk$set(comment = NA, 
               echo = FALSE, 
               warning = FALSE, 
               message = FALSE, 
               error = TRUE, 
               cache = FALSE,
               fig.width = 8.64,
               fig.height = 4.86,
               fig.path = 'figures/')
source('prepare_data.R')
numberfy <- function(x){
  gsub(',', '.', scales::comma(x), fixed = TRUE)
}
options(scipen = '999')
yl <- seq(0, 500000, 100000)
ggplot(data = agg,
       aes(x = hour,
           y = interactions)) +
  geom_step() +
  # geom_bar(stat = 'identity',
  #          alpha = 0.9,
  #           fill = 'darkorange',
  #          # color = 'white',
  #          width = 1) +
  # geom_area(alpha = 0.6,
  #           fill = 'darkorange') +
  # geom_line() +
  theme_vilaweb() +
  theme(axis.title.y = element_text(size = 10),
        axis.text.y = element_text(size = 8),
        plot.caption = element_text(size = 8)) +
  scale_y_continuous(breaks = yl,
                     labels = numberfy(yl)) +
  labs(x = 'Dia',
       y = 'Interaccions (piulets + repiulets + m\'agrada)',
       title = 'Interaccions a Twitter esmentant Inés Arrimadas',
       subtitle = '(@InesArrimadas o "Arrimadas")',
       caption = 'Dades de Twitter | Gràfic de @joethebrew | www.vilaweb.cat')
sum(agg$retweets)
sum(agg$likes)
range(agg$hour)


joebrew/vilaweb documentation built on Sept. 11, 2020, 3:42 a.m.