Commit 2dd3a0f7 authored by numeroteca's avatar numeroteca

datavis por nº menciones y cuándo aparece en telediarios

parents
Pipeline #126 failed with stages
# Script to process Verba data
# ---- Load libraries -----
library(tidyverse)
# Load data
data <- read.delim("data/verba/180320_180430_cifuentes-y-palabras-relacionadas_clasificado.csv",sep = ",")
# Preprocess data -------
data$date <- as.Date(data$date)
data$date2 <- as.POSIXct(data$date)
levels(data$telediario) <- c("15:00h","21.00h")
data$date2[1] + 3600
# Settings
subtitle_text <- "Telediarios de TVE. 20 marzo - 29 abril 2018"
caption_text <- "Datos: Verba. Gráfico: numeroteca.org"
# Plots ----------------------
# Número de frases por telediario
png(filename=paste("img/apariciones-n-telediarios-caso-master_01.png", sep = ""),width = 1200,height = 900)
ggplot(data = data ) +
geom_bar(aes( x=date2,fill=caso )) +
theme_minimal(base_family = "Roboto Condensed", base_size = 22) +
scale_x_datetime(date_breaks = "1 day", date_labels = "%d") +
labs(title = paste("Número de frases sobre caso Máster (Cristina Cifuentes)",sep = ""),
subtitle = subtitle_text,
x = NULL,
y = "nº de frases",
caption = caption_text) +
theme(
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank(),
# panel.grid.major.x = element_blank(),
panel.grid.major.y = element_blank()
) +
facet_wrap( ~telediario, ncol=1)
dev.off()
# Cuando hablan del caso dentro del Telediario
png(filename=paste("img/apariciones-cuando-telediarios-caso-master_01.png", sep = ""),width = 1200,height = 900)
ggplot(data = data ) + #%>% filter( date> "2018-04-01" & date < "2018-04-05" )
geom_rect(aes( xmin=min(data$date2+ 41000) , xmax=max(data$date2+ 82800+ 40000), ymin=0,ymax=90/60), alpha = 0.02, fill = "lightgrey" ) +
geom_segment( aes(x = date2 + 82800, xend = date2 + 82800, y = start_time/60, yend = (start_time+30)/60, color=caso), alpha = 0.8, size=9) +
geom_hline(aes(yintercept=0), size=0.1) +
# anotate
geom_curve(aes(x = as.POSIXct("2018-03-24"), y = 0.5, xend = as.POSIXct("2018-03-26"), yend = 7),
color="#999999", data =data, curvature = -0.2, size = 0.1) +
annotate(geom = "text", x = as.POSIXct("2018-03-26"), y = 7, label = "Portada (1:30 minutos)",
family = "Roboto Condensed", hjust = 0,size=6,size=0.6) +
theme_minimal(base_family = "Roboto Condensed", base_size = 22) +
scale_x_datetime(date_breaks = "1 day", date_labels = "%d", expand= c(0.01,0.05)) +
labs(title = paste("Cuándo hablan del caso Máster (Cristina Cifuentes) en los telediarios",sep = ""),
subtitle = paste(subtitle_text),
x = NULL,
y = "minutos",
caption = caption_text) +
theme(
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank(),
# panel.grid.major.x = element_blank(),
panel.grid.major.y = element_blank()
) +
facet_wrap( ~telediario, ncol=1)
dev.off()
s
\ No newline at end of file
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment