Skip to content

Instantly share code, notes, and snippets.

@wagenrace
Created August 17, 2023 10:46
Show Gist options
  • Save wagenrace/d5fd3c25d4b5767457b09f9bdb20823d to your computer and use it in GitHub Desktop.
Save wagenrace/d5fd3c25d4b5767457b09f9bdb20823d to your computer and use it in GitHub Desktop.
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