Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active February 3, 2026 20:24
Show Gist options
  • Select an option

  • Save dacr/c30d04edc324f09039c1fb7d07a2b7ca to your computer and use it in GitHub Desktop.

Select an option

Save dacr/c30d04edc324f09039c1fb7d07a2b7ca to your computer and use it in GitHub Desktop.
display examples keywords frequency cloud tags graph / published by https://github.com/dacr/code-examples-manager #5ecc1661-bb03-40c5-af6f-6d95941b0855/7afe04d8eef523058455548641508c9e6fc8abeb
#!/usr/bin/env python3
## summary : display examples keywords frequency cloud tags graph
## keywords : python, examples, keywords
## publish : gist, corporate
## authors : David Crosson
## license : Apache License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
## id : 5ecc1661-bb03-40c5-af6f-6d95941b0855
## created-on : 2020-10-06T15:00:25Z
## managed-by : https://github.com/dacr/code-examples-manager
## execution : python 3 with pip requirements (numpy,matplotlib,wordcloud) 'python3 scriptname.sc'
## run-with : python3 $file
# apt install python3-pip
# pip3 install numpy
# pip3 install matplotlib
# pip3 install wordcloud
# python3 cem-word-cloud.py
import numpy as np
import matplotlib.pyplot as plt
from wordcloud import WordCloud
import subprocess
text = subprocess.getoutput("find .. -type f -exec egrep '^[-/# ]+keywords : ' {} \; | cut -d ':' -f 2 | tr -d ,")
wc = WordCloud(
width=1200,
height=800,
background_color="white",
repeat=False,
regexp=r"[-_a-zA-Z0-9]+",
collocations=False,
normalize_plurals=False,
colormap="tab10",
max_words=500
)
wc.generate(text)
plt.axis("off")
plt.imshow(wc, interpolation="bilinear")
plt.tight_layout()
plt.show()
@dacr
Copy link
Copy Markdown
Author

dacr commented Oct 7, 2020

Yes first python script published

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment