Skip to content

Commit

Permalink
Correct colormap
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Aug 16, 2024
1 parent f6b1377 commit 5a5593d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ def setup(app):
labels = [lang[0] for lang in langs]
sizes = [float(lang[1]) for lang in langs]
counts = [countfiles(lang) for lang in labels]
size = max(10, len(labels))
colormap = plt.get_cmap('tab10' if len(labels) <= 10 else 'tab20')
colors = [colormap(idx / len(labels)) for idx, _ in enumerate(labels)]
colors = [colormap(idx / size) for idx, _ in enumerate(labels)]
_, ax = plt.subplots()
ax.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', labeldistance=None, pctdistance=0.85)
plt.legend(title='Languages', loc='right', bbox_to_anchor=(1,0.5), bbox_transform=plt.gcf().transFigure)
Expand Down

0 comments on commit 5a5593d

Please sign in to comment.