Commit a93ceb56 authored by numeroteca's avatar numeroteca
Browse files

añade segundo eje a gráficos y publica imágenes casos cifuentes y lezo

parent e7c6b398
......@@ -6,19 +6,21 @@ library(tidyverse)
# Settings ------
# subtitle_text <- "Telediarios de TVE. 20 marzo - 29 abril 2018"
# subtitle_text <- "Telediarios de TVE. 4 enero - 28 febrero 2017"
subtitle_text <- "Telediarios de TVE. 1 marzo - 30 junio 2017"
# el_caso <- "caso Máster (Cristina Cifuentes)"
el_caso <- "caso Lezo y caso Púnica"
caso_path <- "lezo-punica"
# subtitle_text <- "Telediarios de TVE. 1 marzo - 30 junio 2017"
subtitle_text <- "Telediarios de TVE"
# el_caso <- "caso Lezo y caso Púnica"
# caso_path <- "lezo-punica"
el_caso <- "caso Máster (Cristina Cifuentes)"
caso_path <- "cifuentes"
# el_caso <- "Messi"
caption_text <- "Datos: Verba (Civio). Gráfico: numeroteca.org"
caption_text <- "Datos: verba.civio.es (Civio). Gráfico: numeroteca.org"
# Load data ---------------
# data <- read.delim("data/verba/180320_180430_cifuentes-y-palabras-relacionadas_clasificado.csv",sep = ",")
data <- read.delim("data/verba/180320_180430_cifuentes-y-palabras-relacionadas_clasificado.csv",sep = ",")
# data <- read.delim("data/verba/140104_140228_barcenas-palabras-relacionadas_01.csv",sep = ",")
# data <- read.delim("data/verba/140104_140228_messi_01.csv",sep = ",")
data <- read.delim("data/verba/170301_170630_lezo-punica.csv",sep = ",")
# data <- read.delim("data/verba/170301_170630_lezo-punica.csv",sep = ",")
......@@ -56,11 +58,11 @@ ggplot(data = data ) +
geom_bar(aes( x=date2 )) + # si hay clasificación por caso: fill=caso
theme_minimal(base_family = "Roboto Condensed", base_size = 22) +
# scale_x_datetime(date_breaks = "1 day", date_labels = "%d") +
scale_x_datetime(date_breaks = "5 day",
date_labels = "%d",
scale_x_datetime(date_breaks = "1 week",
date_labels = "%d/%m",
#secondary axis to add months
sec.axis = sec_axis(~ .,
labels = scales::time_format("%b"))
labels = scales::time_format("%b/%y"))
) +
labs(title = paste("Número de frases sobre ",el_caso,sep = ""),
subtitle = subtitle_text,
......@@ -80,8 +82,10 @@ dev.off()
# Cuando hablan del caso dentro del Telediario
png(filename=paste("img/",caso_path ,"/apariciones-cuando-telediarios_",caso_path,"_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), alpha = 0.8, size=4) + #, color=caso
# primer minuto y medio (90 segundos)
geom_rect(aes( xmin=min(data$date2+ 41000) , xmax=max(data$date2+ 82800+ 40000), ymin=0,ymax=120/60), alpha = 0.02, fill = "lightgrey" ) +
geom_text( data = data %>% top_n(1,date), aes (min(data$date2+500000), 2, label="primeros 2 minutos"),base_family = "Roboto Condensed") +
geom_segment( aes(x = date2 + 82800, xend = date2 + 82800, y = start_time/60, yend = (start_time+30)/60), alpha = 0.8, size=12) + #, color=caso
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),
......@@ -89,11 +93,15 @@ ggplot(data = data ) + #%>% filter( date> "2018-04-01" & date < "2018-04-05" )
# 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 = 18) +
scale_x_datetime(date_breaks = "1 day", date_labels = "%d", expand= c(0.01,0.05)) +
scale_x_datetime(date_breaks = "1 day", date_labels = "%d", expand= c(0.01,0.05),
#secondary axis to add months
sec.axis = sec_axis(~ .,
# date_breaks = "1 month",
labels = scales::time_format("%b/%y"))) +
labs(title = paste("Cuándo hablan del ",el_caso, " en los telediarios",sep = ""),
subtitle = paste(subtitle_text),
x = NULL,
y = "minutos",
y = "minutos desde el inicio",
caption = caption_text) +
theme(
panel.grid.minor.x = element_blank(),
......@@ -104,15 +112,47 @@ ggplot(data = data ) + #%>% filter( date> "2018-04-01" & date < "2018-04-05" )
facet_wrap( ~telediario_fino, ncol=1)
dev.off()
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=120/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=10) +
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 (2 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),
#secondary axis to add months
sec.axis = sec_axis(~ .,
# date_breaks = "1 month",
labels = scales::time_format("%b/%y"))) +
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()
png(filename=paste("img/apariciones-cuando-telediarios-caso-master_01_v.png", sep = ""),width = 900,height = 1200)
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_rect(aes( xmin=min(data$date2+ 41000) , xmax=max(data$date2+ 82800+ 40000), ymin=0,ymax=120/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=10) +
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)",
annotate(geom = "text", x = as.POSIXct("2018-03-26"), y = 7, label = "Portada (2 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)) +
......
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