1
0
mw-lifecycle-analysis/p2/phab-new-task-plot-script.R
Matthew Gaughan 822103ec3a new task plot
2025-07-29 14:48:52 -07:00

80 lines
3.9 KiB
R

library(tidyverse)
df_path <-"/mmfs1/home/mjilg/git/mw-lifecycle-analysis/p2/071425_master_discussion_data.csv"
combined_df <- read.csv(df_path, header = TRUE) |>
filter(comment_type == "task_description")
combined_count_df <- combined_df |>
group_by(AuthorWMFAffil, week_index, source) %>%
summarise(unique_count = n_distinct(id), .groups = "drop")
library(scales)
library(ggplot2)
affiliationColors <-
setNames( c('#5da2d8', '#c7756a')
,c("False", "True"))
new_tasks <- combined_count_df |>
ggplot(aes(x=week_index,
y=unique_count,
fill=factor(AuthorWMFAffil))) +
geom_col(position='dodge2') +
labs(x = "Relative Week", y = "New Tasks Created", fill="Task Author") +
geom_vline(data = combined_df |> filter(source == "c1"),
aes(xintercept = -29),
linetype = "dotted", color = "black", linewidth = 0.5) +
geom_vline(data = combined_df |> filter(source == "c1"),
aes(xintercept = -9),
linetype = "dotted", color = "black", linewidth = 0.5) +
geom_vline(data = combined_df |> filter(source == "c1"),
aes(xintercept = -4),
linetype = "3313", color = "black", linewidth = 0.5) +
geom_vline(data = combined_df |> filter(source == "c2"),
aes(xintercept = -99),
linetype = "dotted", color = "black", linewidth = 0.5) +
geom_vline(data = combined_df |> filter(source == "c2"),
aes(xintercept = -4),
linetype = "3313", color = "black", linewidth = 0.5) +
geom_vline(data = combined_df |> filter(source == "c3"),
aes(xintercept = -97),
linetype = "dotted", color = "black", linewidth = 0.5) +
geom_vline(data = combined_df |> filter(source == "c3"),
aes(xintercept = -3),
linetype = "3313", color = "black", linewidth = 0.5) +
geom_text(data = data.frame(source = "c1", relative_week = -39, lengthened_commit_count = 130),
aes(x = relative_week, y = lengthened_commit_count, label = "Opt-In Testing Deployment"),
inherit.aes = FALSE, color = "black", size = 4) +
geom_vline(xintercept = 0, linetype = "dashed", color = "black", linewidth = 0.5) + # Add vertical line at week 0
geom_text(data = data.frame(source = "c2", relative_week = 7, lengthened_commit_count = 25),
aes(x = relative_week, y = lengthened_commit_count, label = "Wide Deployment"),
inherit.aes = FALSE, color = "black", size = 4) +
geom_text(data = data.frame(source = "c3", relative_week = -15, lengthened_commit_count = 45),
aes(x = relative_week, y = lengthened_commit_count, label = "Wide Deployment Announcement"),
inherit.aes = FALSE, color = "black", size = 4) +
scale_fill_manual(values = affiliationColors,
labels = c("False" = "Unaffiliated",
"True" = "WMF-affiliated")) +
ggtitle("New Phabricator Tasks During Deployment Process") +
theme_bw()+
theme(
legend.position = "top",
plot.title = element_text(size = 18, face = "bold"), # Increase title font size
axis.title.x = element_text(size = 16), # Increase x-axis title font size
axis.title.y = element_text(size = 16), # Increase y-axis title font size
axis.text.x = element_text(size = 16), # Increase x-axis text font size
axis.text.y = element_text(size = 16), # Increase y-axis text font size
legend.text = element_text(size = 16), # Increase legend text font size
legend.title = element_text(size = 16),
strip.text = element_text(size = 14)# Increase legend title font size
) +
facet_wrap(~source, nrow = 3, scales = "free_y", labeller = labeller(source = c(
"c1" = "VisualEditor (2013)",
"c2" = "HTTPS-as-default (2013)",
"c3" = "HTTP-deprecation (2015)"
)))
new_tasks
#ggsave(filename = "070525-d1-m2-tasks-faceted.png", plot = commit_authors, width = 15, height = 9, dpi = 800)