Browse Source

Edit: participation by date with ggplot2, plots as pdf and png, list of blogs and media

pull/14/head
janwey 1 year ago
parent
commit
dd5b008343

BIN
data/blogs_media.ods View File


BIN
plots/participation_time.pdf → plots/ilfs-participation-by-date.pdf View File


BIN
plots/ilfs-participation-by-date.png View File


BIN
plots/participation_datetime.pdf View File


BIN
plots/participation_platform.pdf View File


BIN
plots/participation_platform.png View File


+ 60
- 43
plotte.R View File

@@ -126,58 +126,75 @@ dev.off()
twitter_datetime <- rev(paste0(twitter$date, twitter$time))
fediver_datetime <- rev(paste0(mastodon$date, mastodon$time))

library("ggplot2")
twitter_time <- strptime(paste0(twitter$date, twitter$time), format = "%Y%m%d%H%M%S")

ggplot(data = twitter, aes(x=twitter_time)) +
geom_histogram(aes(fill=..count..), binwidth=60*180) +
scale_x_datetime("Date") +
scale_y_continuous("Frequency") +
# ggtitle("Participation in the ILoveFreeSoftware Campaign") +
scale_fill_gradient("Count", low="#640000", high="#FF0000")
opts(title="#ISMB Tweet Frequency July 11-17", legend.position='none')
ggsave(file="./plots/ilfs-participation-by-date.pdf", width=7, height=7)






#### Density Plots of Postings over Time
pdf(file = "./plots/participation_datetime.pdf", height = 7, width = 14)
#pdf(file = "./plots/participation_datetime.pdf", height = 7, width = 14)
##### Fediverse (initial plot)
plot(density(as.numeric(fediver_datetime)),
type = "h", xaxt = "n", yaxt = "n",
xlab = "", ylab = "Frequency Posts",
main = "Participation around I Love Free Software Day",
col = "#a22430", axes = FALSE, lwd = 0.6)
# plot(density(as.numeric(fediver_datetime)),
# type = "h", xaxt = "n", yaxt = "n",
# xlab = "", ylab = "Frequency Posts",
# main = "Participation around I Love Free Software Day",
# col = "#a22430", axes = FALSE, lwd = 0.6)
##### Twitter
lines(density(as.numeric(twitter_datetime)), type = "h", col = "#1da1f2", lwd = 0.6)
# lines(density(as.numeric(twitter_datetime)), type = "h", col = "#1da1f2", lwd = 0.6)
##### Added Axis (shows date)
axis(side = 1, labels = c("10.02.18", "11.02.18", "12.02.18", "13.02.18", "14.02.18", "15.02.18", "16.02.18"),
at = c(20180210120000, 20180211120000, 20180212120000, 20180213120000, 20180214120000, 20180215120000, 20180216120000))
# axis(side = 1, labels = c("10.02.18", "11.02.18", "12.02.18", "13.02.18", "14.02.18", "15.02.18", "16.02.18"),
# at = c(20180210120000, 20180211120000, 20180212120000, 20180213120000, 20180214120000, 20180215120000, 20180216120000))
##### Add legend
legend(x = "topleft", legend = c("Twitter", "Fediverse"),
fill = c("#1da1f2", "#a22430"), bty = "n")
dev.off()
# legend(x = "topleft", legend = c("Twitter", "Fediverse"),
# fill = c("#1da1f2", "#a22430"), bty = "n")
#dev.off()

#### Extract posting times only on February 14th
twitter_ilfsd <- twitter$time[which(twitter$date == "20180214")]
fediver_ilfsd <- mastodon$time[which(mastodon$date == "20180214")]
#twitter_ilfsd <- twitter$time[which(twitter$date == "20180214")]
#fediver_ilfsd <- mastodon$time[which(mastodon$date == "20180214")]

#### Get aggregated number of posts over time during the day
time <- seq(from = 000000, to = 240000, by = 010000)
twitter_aggregated <- c()
for(i in 1:length(time)){
twitter_aggregated[i] <- length(which(as.numeric(rev(twitter_ilfsd)) < time[i]))
}
fediver_aggregated <- c()
for(i in 1:length(time)){
fediver_aggregated[i] <- length(which(as.numeric(rev(fediver_ilfsd)) < time[i]))
}
#time <- seq(from = 000000, to = 240000, by = 010000)
#twitter_aggregated <- c()
#for(i in 1:length(time)){
# twitter_aggregated[i] <- length(which(as.numeric(rev(twitter_ilfsd)) < time[i]))
#}
#fediver_aggregated <- c()
#for(i in 1:length(time)){
# fediver_aggregated[i] <- length(which(as.numeric(rev(fediver_ilfsd)) < time[i]))
#}

#### Plotting the aggregated number of posts during the day
pdf(file = "./plots/participation_time.pdf", height = 7, width = 14)
##### Twitter
plot(x = time, y = twitter_aggregated, type = "l",
main = "Number of Posts about #ilovefs on February 14 2018",
xlab = "Time (UTC)",
ylab = "Number of Posts",
xaxt = "n", col = "#1da1f2", lwd = 3,
axes = FALSE,
ylim = c(0, length(twitter$text) + 50))
##### Fediverse
lines(x = time, y = fediver_aggregated, type = "l", col = "#a22430", lwd = 3)
##### Add Axis (show time and number of posts)
axis(side = 1, labels = c("00:00", "03:00", "06:00", "09:00", "12:00", "15:00", "18:00", "21:00", "24:00"),
at = c(000000, 030000, 060000, 090000, 120000, 150000, 180000, 210000, 240000))
axis(side = 2, labels = as.character(seq(from = 0, to = max(twitter_aggregated) + 100, by = 50)),
at = seq(from = 0, to = max(twitter_aggregated) + 100, by = 50))
##### Add legend
legend(x = "topleft", legend = c("Twitter", "Fediverse"),
fill = c("#1da1f2", "#a22430"), bty = "n")
dev.off()
#pdf(file = "./plots/participation_time.pdf", height = 7, width = 14)
# ##### Twitter
# plot(x = time, y = twitter_aggregated, type = "l",
# main = "Number of Posts about #ilovefs on February 14 2018",
# xlab = "Time (UTC)",
# ylab = "Number of Posts",
# xaxt = "n", col = "#1da1f2", lwd = 3,
# axes = FALSE,
# ylim = c(0, length(twitter$text) + 50))
# ##### Fediverse
# lines(x = time, y = fediver_aggregated, type = "l", col = "#a22430", lwd = 3)
# ##### Add Axis (show time and number of posts)
# axis(side = 1, labels = c("00:00", "03:00", "06:00", "09:00", "12:00", "15:00", "18:00", "21:00", "24:00"),
# at = c(000000, 030000, 060000, 090000, 120000, 150000, 180000, 210000, 240000))
# axis(side = 2, labels = as.character(seq(from = 0, to = max(twitter_aggregated) + 100, by = 50)),
# at = seq(from = 0, to = max(twitter_aggregated) + 100, by = 50))
# ##### Add legend
# legend(x = "topleft", legend = c("Twitter", "Fediverse"),
# fill = c("#1da1f2", "#a22430"), bty = "n")
#dev.off()
# }}}

Loading…
Cancel
Save