From 3fc827560cb3d7560380bfd31c14b0611c819c2d Mon Sep 17 00:00:00 2001 From: Kara Moraw Date: Wed, 14 Aug 2024 13:22:38 +0100 Subject: [PATCH] paul tol colour scheme --- src/analysis/overall_reduced_for_poster.py | 6 ++++-- .../repository_timeline_anon_for_poster.py | 17 ++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/analysis/overall_reduced_for_poster.py b/src/analysis/overall_reduced_for_poster.py index b604c74..8a52197 100644 --- a/src/analysis/overall_reduced_for_poster.py +++ b/src/analysis/overall_reduced_for_poster.py @@ -67,6 +67,7 @@ def plot_license_type(contents, ax): contents.license_type.value_counts().sort_index().plot( kind='barh', ax=ax, + color="#0077bb", #ylabel="license type", #xlabel="repository count" ) @@ -84,6 +85,7 @@ def plot_contributing_file_present(contents, ax): pd.notna(contents.contributing_added).value_counts().plot( kind='barh', ax=ax, + color="#0077bb", #ylabel="contributing file", #xlabel="repository count" ) @@ -116,7 +118,7 @@ def plot_team_size(metadata, contributions, ax): counts, bins = np.histogram(max_team_size, bins) binlabels = [f"[{bins[i]} - {bins[i+1]})" for i in range(len(bins)-2)] binlabels += [f"[{bins[-2]} - {bins[-1]}]"] - ax.barh(binlabels, counts) + ax.barh(binlabels, counts, color="#0077bb") ax.bar_label(ax.containers[0]) #ax.set(ylabel="maximum team size", xlabel="repository count") ax.set(xlabel="repository count") @@ -132,7 +134,7 @@ def plot_readme_size(contents, ax, type="bar"): """ bins = [0, 1, 300, 1500, 10000] binmeanings = ["none", "ultra-short", "short", "informative", "detailed"] - colours = ["#3875b1", "#f1882e", "#4d9d39", "#c73f30", "#8e6aba"] + colours = ["#0077bb", "#33bbee", "#009988", "#ee7733", "#cc3311"] if contents.readme_size.max() > bins[-1]: bins.append(contents.readme_size.max()) counts, bins = np.histogram(contents.readme_size, bins) diff --git a/src/analysis/repository_timeline_anon_for_poster.py b/src/analysis/repository_timeline_anon_for_poster.py index a0ff6a2..f171104 100644 --- a/src/analysis/repository_timeline_anon_for_poster.py +++ b/src/analysis/repository_timeline_anon_for_poster.py @@ -77,8 +77,8 @@ def engagement_user_highlights(users, metadata, forks, stars, ax): user_forks["week_since_repo_creation"] = (user_forks.date - user_forks.created_at).dt.days // 7 user_stars = pd.merge(stars[stars.user.isin(users)], metadata, on="github_user_cleaned_url") user_stars["week_since_repo_creation"] = (user_stars.date - user_stars.created_at).dt.days // 7 - ax.scatter(user_forks.week_since_repo_creation, user_forks.user, marker="v", s=100, label="forked") - ax.scatter(user_stars.week_since_repo_creation, user_stars.user, marker="v", s=100, label="starred") + ax.scatter(user_forks.week_since_repo_creation, user_forks.user, marker="v", s=100, label="forked", c="#ee7733") + ax.scatter(user_stars.week_since_repo_creation, user_stars.user, marker="v", s=100, label="starred", c="#009988") def user_type_wrt_issues(issues, metadata, forks, stars, analysis_end_date, ax): """Plot every user's issue interaction type (opening issues, closing issues, both) with engagement highlight dates scattered on top. @@ -120,7 +120,7 @@ def user_type_wrt_issues(issues, metadata, forks, stars, analysis_end_date, ax): y="user", hue="status", hue_order=["inactive", "opening", "closing", "both"], - palette=['#d62728', '#1f77b4', '#ff7f0e', '#2ca02c'], + palette=['#cc3311', '#0077bb', '#ee7733', '#009988'], marker="|", s=500, ) @@ -154,7 +154,7 @@ def contributor_team(contributions, metadata, forks, stars, axs): y="author", hue="active contributors", hue_order=["inactive", "active"], - palette=['#d62728', '#2ca02c'], + palette=['#cc3311', '#009988'], marker="|", s=500, ) @@ -167,6 +167,7 @@ def contributor_team(contributions, metadata, forks, stars, axs): team_size.plot( ax=axs[1], lw=2, + color="#0077bb", # xlabel="week since repo creation", ylabel="number of\ncontributors", ) @@ -177,6 +178,7 @@ def contributor_team(contributions, metadata, forks, stars, axs): contrib_pool.plot( ax=axs[1], lw=2, + color="#ee7733", ) def no_open_and_closed_issues(issues, metadata, analysis_end_date, ax): @@ -210,6 +212,7 @@ def no_open_and_closed_issues(issues, metadata, analysis_end_date, ax): ax=ax, x="week_since_repo_creation", y=["open issues", "closed issues"], + color=["#0077bb", "#ee7733"], lw=2, # xlabel="week since repo creation", ylabel="issue count" @@ -242,7 +245,8 @@ def engagement(forks, stars, metadata, analysis_end_date, ax): engagement_df.plot( ax=ax, lw=2, - ylabel="count" + ylabel="count", + color=["#0077bb", "#ee7733"], ) def calc_y_timeline(data): @@ -304,8 +308,7 @@ def date_highlights(readme_history, contents, metadata, paper_data, ax, overlay_ data = [ownership_added, usage_added, citation_added, citation_file_added, contributing_file_added, paper_published] ys = calc_y_timeline(data) labels = ["ownership heading (add/change)", "usage heading (add/change)", "citation in README (add/change)", "citation file added", "contributing file added", "mention in publication"] - prop_cycle = plt.rcParams['axes.prop_cycle'] - colors = prop_cycle.by_key()['color'] + colors = ["#0077bb", "#33bbee", "#009988", "#ee7733", "#cc3311", "#ee3377"] ymax = 100 for i in range(len(data)): ax.scatter(data[i], ys[i], marker="^", s=100, label=labels[i], color=colors[i])