Skip to content

Commit

Permalink
paul tol colour scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
karacolada committed Aug 14, 2024
1 parent 089b082 commit 3fc8275
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/analysis/overall_reduced_for_poster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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"
)
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand Down
17 changes: 10 additions & 7 deletions src/analysis/repository_timeline_anon_for_poster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand All @@ -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",
)
Expand All @@ -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):
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit 3fc8275

Please sign in to comment.