Skip to content
Snippets Groups Projects
Commit 19166ecc authored by Françoise Conil's avatar Françoise Conil
Browse files

New graphs removing the backends declared less than 5 times

parent 345b0958
No related branches found
No related tags found
No related merge requests found
...@@ -11,19 +11,29 @@ import sqlite3 ...@@ -11,19 +11,29 @@ import sqlite3
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
BACKEND_PATH = Path("~/Progs/python/duckdb/pyproject_backends.db") BACKEND_PATH = Path("~/Progs/python/duckdb/pyproject_backends.db")
QUERY = "SELECT * FROM backends"
QUERY_COUNT = "SELECT COUNT(*) AS nb FROM backends WHERE backend IS NOT NULL;"
# QUERY = "SELECT backend, COUNT(backend) AS nb FROM backends WHERE backend IS NOT NULL GROUP BY backend;"
QUERY = """SELECT backend, COUNT(backend) AS nb
FROM backends
WHERE backend IS NOT NULL
GROUP BY backend
HAVING COUNT(backend) > 5;
"""
if __name__ == "__main__": if __name__ == "__main__":
cnx = sqlite3.connect(f"file:{str(BACKEND_PATH.expanduser())}?mode=ro") cnx = sqlite3.connect(f"file:{str(BACKEND_PATH.expanduser())}?mode=ro")
cnx.row_factory = sqlite3.Row cnx.row_factory = sqlite3.Row
cur = cnx.cursor() cur = cnx.cursor()
cur.execute("SELECT COUNT(*) AS nb FROM backends WHERE backend IS NOT NULL;") cur.execute(QUERY_COUNT)
r = cur.fetchone() r = cur.fetchone()
backends_total = r['nb'] backends_total = r['nb']
cur.execute("SELECT backend, COUNT(backend) AS nb FROM backends WHERE backend IS NOT NULL GROUP BY backend;") cur.execute(QUERY)
r = cur.fetchall() r = cur.fetchall()
...@@ -32,12 +42,12 @@ if __name__ == "__main__": ...@@ -32,12 +42,12 @@ if __name__ == "__main__":
cnx.close() cnx.close()
fig = plt.figure(num='Backends on PyPI', figsize=(12,8)) fig = plt.figure(num='Backends on PyPI', figsize=(12,8), dpi=600)
ax = fig.add_subplot(1, 1, 1) ax = fig.add_subplot(1, 1, 1)
bars = ax.bar(backends, backend_nb, color=['blue' if n > 500 else 'cyan' for n in backend_nb]) bars = ax.bar(backends, backend_nb, color=['blue' if n > 500 else 'cyan' for n in backend_nb])
ax.set_title(f'{backends_total} backends declared in pyproject.toml on PyPI (2018-2023)') ax.set_title(f'{backends_total} backends declared in pyproject.toml on PyPI (2018-2023), removing nb < 5, log scale')
ax.set_xlabel("Backend") ax.set_xlabel("Backend")
ax.set_ylabel("Times declared") ax.set_ylabel("Times declared")
...@@ -55,7 +65,7 @@ if __name__ == "__main__": ...@@ -55,7 +65,7 @@ if __name__ == "__main__":
ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height() + 0.5, str(nb), ha='center', va='bottom') ax.text(bar.get_x() + bar.get_width() / 2, bar.get_height() + 0.5, str(nb), ha='center', va='bottom')
# Set logarithmic scale on y-axis # Set logarithmic scale on y-axis
ax.set_yscale('log') # ax.set_yscale('log')
# Color x-axis labels based on the condition # Color x-axis labels based on the condition
for label, n in zip(ax.get_xticklabels(), backend_nb): for label, n in zip(ax.get_xticklabels(), backend_nb):
...@@ -63,8 +73,8 @@ if __name__ == "__main__": ...@@ -63,8 +73,8 @@ if __name__ == "__main__":
label.set_color('blue') label.set_color('blue')
# Adjust layout to prevent clipping of rotated labels # Adjust layout to prevent clipping of rotated labels
# plt.tight_layout() plt.tight_layout()
#plt.show() #plt.show()
plt.savefig("python-backends-2018-2023.png", dpi=600) plt.savefig("python-backends-2018-2023.png")
python-backends-2018-2023-log-scale.png

412 KiB | W: | H:

python-backends-2018-2023-log-scale.png

203 KiB | W: | H:

python-backends-2018-2023-log-scale.png
python-backends-2018-2023-log-scale.png
python-backends-2018-2023-log-scale.png
python-backends-2018-2023-log-scale.png
  • 2-up
  • Swipe
  • Onion skin
python-backends-2018-2023.png

410 KiB | W: | H:

python-backends-2018-2023.png

203 KiB | W: | H:

python-backends-2018-2023.png
python-backends-2018-2023.png
python-backends-2018-2023.png
python-backends-2018-2023.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment