Skip to content

Instantly share code, notes, and snippets.

@wagenrace
Created August 17, 2023 10:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
from license_scanner import get_all_licenses
figure(figsize=(18, 16), dpi=80)
all_licenses = get_all_licenses()
l1 = []
labels = []
sizes = []
for license_name, packages in all_licenses.items():
l1.append([len(packages), license_name])
l1.sort(key=lambda a: -a[0])
total_num_packages = sum([i[0] for i in l1])
for i in l1:
labels.append(i[1])
sizes.append(i[0])
print(f"{i[1]}: {100 * i[0]/total_num_packages:.2f}%")
plt.pie(sizes, labels=labels)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment