Browse Source

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

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()
126 126
 twitter_datetime <- rev(paste0(twitter$date, twitter$time))
127 127
 fediver_datetime <- rev(paste0(mastodon$date, mastodon$time))
128 128
 
129
+library("ggplot2")
130
+twitter_time <- strptime(paste0(twitter$date, twitter$time), format = "%Y%m%d%H%M%S")
131
+
132
+ggplot(data = twitter, aes(x=twitter_time)) + 
133
+  geom_histogram(aes(fill=..count..), binwidth=60*180) + 
134
+  scale_x_datetime("Date") + 
135
+  scale_y_continuous("Frequency") +
136
+#  ggtitle("Participation in the ILoveFreeSoftware Campaign") +
137
+  scale_fill_gradient("Count", low="#640000", high="#FF0000")
138
+  opts(title="#ISMB Tweet Frequency July 11-17", legend.position='none')
139
+ggsave(file="./plots/ilfs-participation-by-date.pdf", width=7, height=7)
140
+
141
+
142
+
143
+
144
+
145
+
129 146
 #### Density Plots of Postings over Time
130
-pdf(file = "./plots/participation_datetime.pdf", height = 7, width = 14)
147
+#pdf(file = "./plots/participation_datetime.pdf", height = 7, width = 14)
131 148
   ##### Fediverse (initial plot)
132
-  plot(density(as.numeric(fediver_datetime)),
133
-     type = "h", xaxt = "n", yaxt = "n",
134
-     xlab = "", ylab = "Frequency Posts",
135
-     main  = "Participation around I Love Free Software Day",
136
-     col = "#a22430", axes = FALSE, lwd = 0.6)
149
+#  plot(density(as.numeric(fediver_datetime)),
150
+#     type = "h", xaxt = "n", yaxt = "n",
151
+#     xlab = "", ylab = "Frequency Posts",
152
+#     main  = "Participation around I Love Free Software Day",
153
+#     col = "#a22430", axes = FALSE, lwd = 0.6)
137 154
   ##### Twitter
138
-  lines(density(as.numeric(twitter_datetime)), type = "h", col = "#1da1f2", lwd = 0.6)
155
+#  lines(density(as.numeric(twitter_datetime)), type = "h", col = "#1da1f2", lwd = 0.6)
139 156
   ##### Added Axis (shows date)
140
-  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"),
141
-     at = c(20180210120000, 20180211120000, 20180212120000, 20180213120000, 20180214120000, 20180215120000, 20180216120000))
157
+#  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"),
158
+#     at = c(20180210120000, 20180211120000, 20180212120000, 20180213120000, 20180214120000, 20180215120000, 20180216120000))
142 159
   ##### Add legend
143
-  legend(x = "topleft", legend = c("Twitter", "Fediverse"),
144
-       fill = c("#1da1f2", "#a22430"), bty = "n")
145
-dev.off()
160
+#  legend(x = "topleft", legend = c("Twitter", "Fediverse"),
161
+#       fill = c("#1da1f2", "#a22430"), bty = "n")
162
+#dev.off()
146 163
 
147 164
 #### Extract posting times only on February 14th
148
-twitter_ilfsd <- twitter$time[which(twitter$date == "20180214")]
149
-fediver_ilfsd <- mastodon$time[which(mastodon$date == "20180214")]
165
+#twitter_ilfsd <- twitter$time[which(twitter$date == "20180214")]
166
+#fediver_ilfsd <- mastodon$time[which(mastodon$date == "20180214")]
150 167
 
151 168
 #### Get aggregated number of posts over time during the day
152
-time <- seq(from = 000000, to = 240000, by = 010000)
153
-twitter_aggregated <- c()
154
-for(i in 1:length(time)){
155
-  twitter_aggregated[i] <- length(which(as.numeric(rev(twitter_ilfsd)) < time[i]))
156
-}
157
-fediver_aggregated <- c()
158
-for(i in 1:length(time)){
159
-  fediver_aggregated[i] <- length(which(as.numeric(rev(fediver_ilfsd)) < time[i]))
160
-}
169
+#time <- seq(from = 000000, to = 240000, by = 010000)
170
+#twitter_aggregated <- c()
171
+#for(i in 1:length(time)){
172
+#  twitter_aggregated[i] <- length(which(as.numeric(rev(twitter_ilfsd)) < time[i]))
173
+#}
174
+#fediver_aggregated <- c()
175
+#for(i in 1:length(time)){
176
+#  fediver_aggregated[i] <- length(which(as.numeric(rev(fediver_ilfsd)) < time[i]))
177
+#}
161 178
 
162 179
 #### Plotting the aggregated number of posts during the day
163
-pdf(file = "./plots/participation_time.pdf", height = 7, width = 14)
164
-  ##### Twitter
165
-  plot(x = time, y = twitter_aggregated, type = "l",
166
-     main = "Number of Posts about #ilovefs on February 14 2018",
167
-     xlab = "Time (UTC)",
168
-     ylab = "Number of Posts",
169
-     xaxt = "n", col = "#1da1f2", lwd = 3,
170
-     axes = FALSE,
171
-     ylim = c(0, length(twitter$text) + 50))
172
-  ##### Fediverse
173
-  lines(x = time, y = fediver_aggregated, type = "l", col = "#a22430", lwd = 3)
174
-  ##### Add Axis (show time and number of posts)
175
-  axis(side = 1, labels = c("00:00", "03:00", "06:00", "09:00", "12:00", "15:00", "18:00", "21:00", "24:00"),
176
-     at = c(000000, 030000, 060000, 090000, 120000, 150000, 180000, 210000, 240000))
177
-  axis(side = 2, labels = as.character(seq(from = 0, to = max(twitter_aggregated) + 100, by = 50)),
178
-       at = seq(from = 0, to = max(twitter_aggregated) + 100, by = 50))
179
-  ##### Add legend
180
-  legend(x = "topleft", legend = c("Twitter", "Fediverse"),
181
-       fill = c("#1da1f2", "#a22430"), bty = "n")
182
-dev.off()
180
+#pdf(file = "./plots/participation_time.pdf", height = 7, width = 14)
181
+#  ##### Twitter
182
+#  plot(x = time, y = twitter_aggregated, type = "l",
183
+#     main = "Number of Posts about #ilovefs on February 14 2018",
184
+#     xlab = "Time (UTC)",
185
+#     ylab = "Number of Posts",
186
+#     xaxt = "n", col = "#1da1f2", lwd = 3,
187
+#     axes = FALSE,
188
+#     ylim = c(0, length(twitter$text) + 50))
189
+#  ##### Fediverse
190
+#  lines(x = time, y = fediver_aggregated, type = "l", col = "#a22430", lwd = 3)
191
+#  ##### Add Axis (show time and number of posts)
192
+#  axis(side = 1, labels = c("00:00", "03:00", "06:00", "09:00", "12:00", "15:00", "18:00", "21:00", "24:00"),
193
+#     at = c(000000, 030000, 060000, 090000, 120000, 150000, 180000, 210000, 240000))
194
+#  axis(side = 2, labels = as.character(seq(from = 0, to = max(twitter_aggregated) + 100, by = 50)),
195
+#       at = seq(from = 0, to = max(twitter_aggregated) + 100, by = 50))
196
+#  ##### Add legend
197
+#  legend(x = "topleft", legend = c("Twitter", "Fediverse"),
198
+#       fill = c("#1da1f2", "#a22430"), bty = "n")
199
+#dev.off()
183 200
 # }}}

Loading…
Cancel
Save