{"spec_id":"wordcloud-basic","library":"matplotlib","language":"python","code":"\"\"\" anyplot.ai\nwordcloud-basic: Basic Word Cloud\nLibrary: matplotlib 3.11.1 | Python 3.13.14\nQuality: 89/100 | Updated: 2026-08-04\n\"\"\"\n\nimport os\n\nimport matplotlib.pyplot as plt\nfrom wordcloud import WordCloud\n\n\n# Theme tokens (see prompts/default-style-guide.md \"Background\" + \"Theme-adaptive Chrome\")\nTHEME = os.getenv(\"ANYPLOT_THEME\", \"light\")\nPAGE_BG = \"#FAF8F1\" if THEME == \"light\" else \"#1A1A17\"\nINK = \"#1A1A17\" if THEME == \"light\" else \"#F0EFE8\"\n\n# Imprint palette — 8 hues, canonical order (see prompts/default-style-guide.md)\nIMPRINT = [\"#009E73\", \"#C475FD\", \"#4467A3\", \"#BD8233\", \"#AE3030\", \"#2ABCCD\", \"#954477\", \"#99B314\"]\n\n# Data - Tech industry survey responses about most valued skills\nword_frequencies = {\n    \"Python\": 150,\n    \"JavaScript\": 120,\n    \"Data\": 110,\n    \"Machine Learning\": 100,\n    \"Cloud\": 95,\n    \"API\": 90,\n    \"Database\": 85,\n    \"Security\": 80,\n    \"DevOps\": 75,\n    \"Java\": 72,\n    \"Docker\": 70,\n    \"Kubernetes\": 65,\n    \"React\": 60,\n    \"SQL\": 58,\n    \"AWS\": 55,\n    \"Golang\": 53,\n    \"Git\": 52,\n    \"Agile\": 50,\n    \"Testing\": 48,\n    \"Linux\": 45,\n    \"TypeScript\": 42,\n    \"Node\": 40,\n    \"REST\": 38,\n    \"Rust\": 36,\n    \"CI/CD\": 35,\n    \"Microservices\": 32,\n    \"Serverless\": 31,\n    \"Azure\": 30,\n    \"MongoDB\": 28,\n    \"Encryption\": 27,\n    \"Redis\": 26,\n    \"GraphQL\": 24,\n    \"Compliance\": 23,\n    \"Terraform\": 22,\n    \"Blockchain\": 20,\n    \"Spark\": 20,\n    \"IoT\": 18,\n    \"Analytics\": 18,\n    \"Frontend\": 16,\n    \"Mentoring\": 16,\n    \"Backend\": 15,\n    \"Code Review\": 15,\n    \"Scalability\": 14,\n    \"Refactoring\": 14,\n    \"Automation\": 13,\n    \"Onboarding\": 13,\n    \"Architecture\": 12,\n    \"Networking\": 11,\n}\n\n# Assign Imprint hues by frequency rank (not by word hash) so color carries\n# meaning: the most-valued skill is always brand green, the runner-up\n# lavender, and so on — a deliberate hierarchy instead of an arbitrary bucket.\nranked_words = sorted(word_frequencies, key=word_frequencies.get, reverse=True)\nrank_color = {word: IMPRINT[i % len(IMPRINT)] for i, word in enumerate(ranked_words)}\n\n\ndef color_func(word, font_size, position, orientation, random_state=None, **kwargs):\n    return rank_color[word]\n\n\nwc = WordCloud(\n    width=3200,\n    height=1800,\n    background_color=PAGE_BG,\n    max_words=100,\n    min_font_size=18,\n    max_font_size=200,\n    random_state=42,\n    prefer_horizontal=0.6,\n    relative_scaling=0.5,\n    margin=4,\n).generate_from_frequencies(word_frequencies)\nwc.recolor(color_func=color_func)\n\n# Plot — see default-style-guide.md \"Visual Sizing Defaults\" for the canvas + sizing values\nfig, ax = plt.subplots(figsize=(8, 4.5), dpi=400, facecolor=PAGE_BG)\nax.set_facecolor(PAGE_BG)\nax.imshow(wc, interpolation=\"bilinear\")\nax.axis(\"off\")\n\n# Title\ntitle = \"wordcloud-basic · python · matplotlib · anyplot.ai\"\ntitle_fontsize = round(12 * 67 / len(title)) if len(title) > 67 else 12\nfig.suptitle(title, fontsize=title_fontsize, fontweight=\"medium\", color=INK, y=0.97)\n\nfig.tight_layout(rect=[0, 0, 1, 0.94])\nplt.savefig(f\"plot-{THEME}.png\", dpi=400, facecolor=PAGE_BG)  # bbox_inches MUST stay default (None)\n"}