Skip to content

Commit 61d84fc

Browse files
committed
Swap out plot with interactive example via bokeh.
1 parent 6f4a582 commit 61d84fc

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

site/numpy_issues.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ warnings.filterwarnings(
3434
"ignore", category=DeprecationWarning, message="parsing timezone"
3535
)
3636
```
37+
```{code-cell} ipython3
38+
# For interactive plots
39+
from bokeh.plotting import figure, show, output_notebook
40+
from bokeh.models import TeX
41+
output_notebook()
42+
```
3743

3844
%TODO improve handling of datetimes (super annoying)
3945

@@ -98,15 +104,19 @@ is {glue:text}`new_issue_avg_lifetime`.
98104
---
99105
tags: [hide-input]
100106
---
101-
fig, ax = plt.subplots(figsize=(16, 12))
102-
ax.hist(new_issue_lifetime.astype("m8[D]").astype(int), bins=np.arange(30))
103-
ax.set_title(
107+
title = (
104108
f"Lifetime of issues created and closed in the last "
105-
f"{(np.datetime64(datetime.datetime.now()) - query_date).astype('m8[D]')}",
106-
fontsize=24
109+
f"{(np.datetime64(datetime.datetime.now()) - query_date).astype('m8[D]')}"
107110
)
108-
ax.set_xlabel("Issue lifetime (days)", fontsize=20)
109-
ax.set_ylabel(r"$\frac{issues}{day}$", fontsize=20);
111+
h, bedges = np.histogram(
112+
new_issue_lifetime.astype("m8[D]").astype(int), bins=np.arange(30)
113+
)
114+
115+
p = figure(width=670, height=400, title=title, tooltips=[("value", "@top")])
116+
p.quad(top=h, bottom=0, left=bedges[:-1], right=bedges[1:])
117+
p.xaxis.axis_label = "Issue lifetime (days)"
118+
p.yaxis.axis_label = TeX(r"\frac{issues}{day}")
119+
show(p)
110120
```
111121

112122
% TODO: add distribution of labels

site/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
numpy
33
matplotlib
44
pandas
5+
bokeh
56
# For the site
67
sphinx
78
myst-nb

0 commit comments

Comments
 (0)