Skip to content

Commit f45926b

Browse files
committed
WIP: Clean up legend a bit.
1 parent 9d63096 commit f45926b

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

site/index.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ tags: []
3333
# For interactive plots
3434
from bokeh.plotting import figure, show, output_notebook
3535
from bokeh.palettes import Category10_10 as palette
36+
from bokeh.models import Legend
3637
output_notebook()
3738
```
3839

@@ -121,12 +122,18 @@ for proj, data in project_prs.items():
121122
tags: [remove-input]
122123
---
123124
p = figure(
124-
width=400,
125+
width=600,
125126
height=400,
126127
title="Merged PRs per month",
127128
x_axis_type="datetime",
128129
)
130+
131+
legend_items = []
129132
for (label, y), color in zip(merged_prs_per_month.items(), itertools.cycle(palette)):
130-
p.line(x, y, color=color, legend_label=label)
133+
l = p.line(x, y, color=color)
134+
legend_items.append((label, [l]))
135+
136+
legend = Legend(items=legend_items, orientation="horizontal")
137+
p.add_layout(legend, "below")
131138
show(p)
132139
```

0 commit comments

Comments
 (0)