1
0
mw-lifecycle-analysis/commit_analysis/commit_plotting.R
2025-02-15 13:55:48 -08:00

41 lines
1.6 KiB
R

library(tidyverse)
count_data_fp <-"/mmfs1/gscratch/comdata/users/mjilg/mw-repo-lifecycles/case1/event_0215_ve_weekly_commit_count_data.csv"
input_df <- read.csv(count_data_fp, header = TRUE)
input_df$nonbot_commit_count <- input_df$commit_count - input_df$bot_commit_count
library(scales)
library(ggplot2)
time_plot <- input_df |>
ggplot(aes(x=relative_week, y=jenkins_commit_count)) +
labs(x="Weekly Offset", y="Gerrit/Jenkins Commit Count") +
geom_smooth() +
geom_vline(xintercept = 0)+
theme_bw() +
theme(legend.position = "top")
time_plot
share_df <- input_df |>
mutate(wikimedia_share = wikimedia_commit_count / nonbot_commit_count) |>
mutate(wikia_share = wikia_commit_count / nonbot_commit_count) |>
mutate(gerrit_share = jenkins_commit_count / nonbot_commit_count) |>
mutate(mw_dev_share = mediawiki_dev_commit_count / nonbot_commit_count) |>
mutate(other_share = (nonbot_commit_count - jenkins_commit_count - wikia_commit_count - wikimedia_commit_count - mediawiki_dev_commit_count) / nonbot_commit_count)|>
drop_na()
share_long <- share_df |>
select(relative_week, wikimedia_share, wikia_share, gerrit_share, mw_dev_share, other_share) |>
pivot_longer(cols = c(wikimedia_share, wikia_share, gerrit_share, mw_dev_share, other_share), names_to = "category", values_to = "share")
share_plot <- share_long |>
ggplot(aes(x=relative_week, y=share, color=category)) +
geom_smooth() +
geom_vline(xintercept = 0)+
labs(x = "Relative Week", y = "Share of Nonbot Commit Count", color = "Affiliation") +
ggtitle("Weekly Share of Nonbot Commit Count by Category") +
theme_bw() +
theme(legend.position = "top")
share_plot