@@ -24,6 +24,18 @@ ecosystem.
2424project_reports
2525```
2626
27+ % TODO: Figure out why bokeh won't render when output_notebook is in a hidden cell
28+
29+ ``` {code-cell} ipython3
30+ ---
31+ tags: []
32+ ---
33+ # For interactive plots
34+ from bokeh.plotting import figure, show, output_notebook
35+ from bokeh.palettes import Category10_10 as palette
36+ output_notebook()
37+ ```
38+
2739% TODO: automate project generation based on which data files are in devstats-data
2840
2941``` {code-cell} ipython3
@@ -81,7 +93,7 @@ for proj in projects:
8193
8294``` {code-cell} ipython3
8395---
84- tags: [remove-input ]
96+ tags: [remove-cell ]
8597---
8698# Num merged PRs per month
8799start_date = today - year
@@ -91,10 +103,8 @@ bedges = np.array(
91103# Proxy date for center of bin
92104x = bedges[:-1] + np.timedelta64(15, "D")
93105
94- fig, ax = plt.subplots(figsize=(16, 12))
95- ax.set_title("Merged PRs", fontsize=24)
96-
97106# NOTE: np.histogram doesn't work on datetimes
107+ merged_prs_per_month = dict()
98108for proj, data in project_prs.items():
99109 merged_prs = data["merged_prs"]
100110 merge_dates = np.array([pr["mergedAt"] for pr in merged_prs], dtype="M8[D]")
@@ -103,7 +113,20 @@ for proj, data in project_prs.items():
103113 num_merged_per_month.append(
104114 sum(1 for md in merge_dates if md > lo and md < hi)
105115 )
106- ax.plot(x, num_merged_per_month, label=proj)
107- ax.legend()
108- plt.show()
116+ merged_prs_per_month[proj] = num_merged_per_month
117+ ```
118+
119+ ``` {code-cell} ipython3
120+ ---
121+ tags: [remove-input]
122+ ---
123+ p = figure(
124+ width=400,
125+ height=400,
126+ title="Merged PRs per month",
127+ x_axis_type="datetime",
128+ )
129+ for (label, y), color in zip(merged_prs_per_month.items(), itertools.cycle(palette)):
130+ p.line(x, y, color=color, legend_label=label)
131+ show(p)
109132```
0 commit comments