...
 
Commits (3)
No preview for this file type
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -7,11 +7,25 @@ library(tidyverse) # for ggplot
load("data/results-cifuentes-02.Rda")
# Set time limits -----
limits_text <- "21 marzo - 30 abril 2018"
my_title <- "PPgate"
limits_text <- "20 enero - 5 febrero 2020"
# limits_text <- "21 marzo - 30 abril 2018"
my_caption <- "Datos: HomePageX. numeroteca.org"
the_case_directory <- "ppgate"
the_case <- word1_explain
my_limit <- c(as.POSIXct("2018-03-20 00:23:00"), as.POSIXct("2018-04-30 00:23:02"))
my_init <- as.POSIXct("2018-03-20 00:00:01")
# Set time limits
# my_limit <- c(as.POSIXct("2018-03-20 00:00:01"), as.POSIXct("2018-04-30 00:23:08"))
# my_init <- as.POSIXlt("2018-03-20 00:00:00")
# Set time limits: fondos reservados proteger PP
my_limit <- c(as.POSIXct("2020-01-20 00:00:01"), as.POSIXct("2020-02-05 12:00:05"))
my_init <- as.POSIXlt("2020-01-20 00:00:01")
# quick fix
# names(results)[7] <- "n_selected_news_1_PPgate"
results$n_selected_news1 <- results$n_selected_news_1_PPgate
# names(results)[14] <- "percent_1_PPgate"
results$percent1 <- results$percent_1_PPgate
# To print weekends ----
# get all the start and end points
......@@ -97,9 +111,9 @@ ggplot(data=results[results$newspaper=="eldiario",]) + # ylim(c(0,100)) +
panel.grid.major.y = element_blank()
)
ggplot(data=results) + # ylim(c(0,100)) +
ggplot(data=results[results$newspaper=="eldiario",]) + # ylim(c(0,100)) +
geom_line(aes(x=date, y=n_news),color="#000000") +
geom_line(aes(x=date, y=n_selected_news1),color="#FF0000")
geom_line(aes(x=date, y=n_selected_news1),color="#FF0000") +
# geom_line(aes(x=date, y=percent),color="#0000DD") +
scale_x_datetime(date_breaks = "1 day", date_labels = "%d", limits = my_limit) +
theme_minimal(base_family = "Roboto Condensed", base_size = 14) +
......@@ -110,7 +124,7 @@ ggplot(data=results) + # ylim(c(0,100)) +
y = 45, label = "nº noticias en portada", family = "Roboto Condensed"),
color = "#000000", alpha=0.6, hjust = 0) +
labs(title = "eldiario.es: nº noticias en portada",
subtitle = "21 marzo - 9 abril 2018. numeroteca.org",
subtitle = limits_text,
x = NULL,
y = NULL,
caption = "") +
......@@ -135,7 +149,7 @@ ggplot(data=results[results$newspaper=="eldiario",]) + #ylim(c(0,30)) +
# y = 15, label = "Porcentaje de noticias en portada", family = "Roboto Condensed"),
# color = "#0000DD", alpha=0.6, hjust = 0) +
labs(title = paste("eldiario.es: porcentaje noticias y nº noticias",word1_explain),
subtitle = "21 marzo - 9 abril 2018.",
subtitle = limits_text,
x = NULL,
y = NULL,
caption = "Datos: numeroteca.org")
......@@ -157,13 +171,13 @@ ggplot(data=results[results$newspaper=="eldiario",]) + #ylim(c(0,30)) +
# y = 15, label = "Porcentaje de noticias en portada", family = "Roboto Condensed"),
# color = "#0000DD", alpha=0.6, hjust = 0) +
labs(title = paste("eldiario.es: porcentaje noticias y nº noticias",word1_explain,"vs",word2_explain),
subtitle = "21 marzo - 9 abril 2018. Datos: numeroteca.org",
subtitle = limits_text,
x = NULL,
y = NULL,
caption = "")
ggplot(data=results[results$newspaper=="elconfidencial",]) + # ylim(c(0,10)) +
# geom_line(aes(x=date, y=n_news),color="#000000") +
geom_line(aes(x=date, y=n_news),color="#000000") +
geom_line(aes(x=date, y=n_selected_news1),color="#FF0000") +
geom_line(aes(x=date, y=percent1),color="#0000DD") +
scale_x_datetime(date_breaks = "1 day", date_labels = "%d",
......@@ -176,7 +190,7 @@ ggplot(data=results[results$newspaper=="elconfidencial",]) + # ylim(c(0,10)) +
y = 3, label = "Porcentaje de noticias en portada", family = "Roboto Condensed"),
color = "#0000DD", alpha=0.6, hjust = 0) +
labs(title = "elconfidencial.es: porcentaje noticias y nº noticias en portada sobre Cifuentes",
subtitle = "21 marzo - 30 abril 2018. Datos: numeroteca.org",
subtitle = limits_text,
x = "Días",
y = NULL,
caption = "")
......@@ -220,11 +234,11 @@ ggplot(data=results[results$newspaper=="elconfidencial",]) + ylim(c(0,120)) +
caption = "")
# Plot para un único periódico
ggplot(data=results[results$newspaper=="elconfidencial",]) + ylim(c(0,130)) +
ggplot(data=results[results$newspaper=="infolibre",]) + # ylim(c(0,130)) +
geom_line(aes(x=date, y=n_news),color="#000000") +
geom_line(aes(x=date, y=n_selected_news1),color="#FF0000") +
geom_line(aes(x=date, y=percent1),color="#0000DD") +
labs(title = "elconfidencial: noticias sobre Cifuentes en portada (total, total selected, %)")
labs(title = paste("elconfidencial: noticias sobre", the_case, "en portada (total, total selected, %)") )
# Plot para un único periódico
ggplot(data=results[results$newspaper=="elpais",]) + ylim(c(0,130)) +
......@@ -249,7 +263,7 @@ ggplot(data=results[results$newspaper=="elespanol",]) + ylim(c(0,140)) +
# Plot para varios periódico -------
# nº de noticias
png(filename=paste0("images/master/n_noticias_multiples-diarios.png"),width = 900,height = 450)
png(filename=paste0("images/",the_case_directory,"/n_noticias_multiples-diarios.png"),width = 900,height = 450)
ggplot(data=results) + # ylim(c(0,140)) +
geom_line(aes(x=date, y=n_news, group=newspaper),color="#000000",size=0.2) +
# geom_line(aes(x=date, y=n_selected_news1, group=newspaper),color="#FF0000") +
......@@ -257,7 +271,7 @@ ggplot(data=results) + # ylim(c(0,140)) +
labs(title = "elDiario - elconfidencial: noticias sobre Cifuentes en portada") +
scale_x_datetime(date_breaks = "2 day", date_labels = "%d", limits = my_limit) +
theme_minimal(base_family = "Roboto Condensed", base_size = 14) +
labs(title = "noticias sobre Cifuentes en portada",
labs(title = "Número de noticias en página de inicio",
subtitle = limits_text,
x = NULL,
y = NULL,
......@@ -271,12 +285,15 @@ ggplot(data=results) + # ylim(c(0,140)) +
dev.off()
# nº de noticias sobre el tema
png(filename=paste0("images/master/n_noticias_caso_multiples-diarios.png"),width = 900,height = 450)
png(filename=paste0("images/",the_case_directory,"/n_noticias_caso_multiples-diarios.png"),width = 900,height = 450)
ggplot(data=results ) + # ylim(c(0,140)) +
# geom_line(aes(x=date, y=n_news, group=newspaper),color="#000000",size=0.2) +
geom_line(aes(x=date, y=n_selected_news1, group=newspaper),color="#FF0000") +
geom_line(aes(x=date, y=n_selected_news_2_PP, group=newspaper),color="#00FFaa") +
geom_line(aes(x=date, y=n_selected_news_4_Barcenas, group=newspaper),color="#aa00FF") +
# geom_line(aes(x=date, y=percent1, group=newspaper),color="#0000DD") +
scale_x_datetime(date_breaks = "2 day", date_labels = "%d", limits = my_limit) +
scale_x_datetime(date_breaks = "1 day", date_labels = "%d", limits = my_limit) +
scale_y_continuous(name="nº noticias", breaks = c(1,2)) +
theme_minimal(base_family = "Roboto Condensed", base_size = 14) +
labs(title = paste("Número de noticias sobre caso",the_case,"en portada") ,
subtitle = limits_text,
......@@ -292,7 +309,7 @@ ggplot(data=results ) + # ylim(c(0,140)) +
dev.off()
# % de noticias sobre el tema
png(filename=paste0("images/master/perc_noticias_caso_multiples-diarios.png"),width = 900,height = 450)
png(filename=paste0("images/",the_case_directory,"/perc_noticias_caso_multiples-diarios.png"),width = 900,height = 450)
ggplot(data=results ) + # ylim(c(0,140)) +
# geom_line(aes(x=date, y=n_news, group=newspaper),color="#000000",size=0.2) +
geom_line(aes(x=date, y=n_selected_news1, group=newspaper),color="#FF0000") +
......@@ -323,7 +340,7 @@ ggplot(data=results ) + ylim(c(0,30)) +
# geom_text(aes(x = "2007", y = 700, label = "Altza"), color = "#568ba5", alpha=1) +
# Plot para varios periódico ['#66c2a5','#fc8d62','#8da0cb','#e78ac3','#a6d854']
ggplot( ) + ylim(c(0,30)) +
ggplot( ) + # ylim(c(0,30)) +
theme_minimal(base_family = "Roboto Condensed", base_size = 14) +
geom_line(data=results[results$newspaper=="eldiario",], aes(x=date, y=percent1, group=newspaper),color="#66c2a5",size=0.7) +
geom_line(data=results[results$newspaper=="elconfidencial",], aes(x=date, y=percent1, group=newspaper),color="#fc8d62",size=0.7) +
......@@ -353,7 +370,7 @@ scale_y_continuous(breaks=seq(0,30,5)) +
geom_text(aes(x = my_init, y = 17, label = "elespanol.com"), color = "#a6d854", alpha=1, hjust = 0) +
geom_text(aes(x = my_init, y = 19, label = "cadenaser"), color = "#777777", alpha=1, hjust = 0) +
geom_text(aes(x = my_init, y = 21, label = "elpais.com"), color = "#8da0cb", alpha=1, hjust = 0) +
ylab ("% de noticias en portada") +
# ylab ("% de noticias en portada") +
labs(title = paste("Porcentaje de noticias sobre",word_explain,"en portada periódicos digitales"),
subtitle = "01 oct 2018 - 18 enero 2019. Datos y visualización: numeroteca.org",
x = "Días",
......