Tuesday, 24 February 2026

๐Ÿซง Day 37: Chord Chart in Python

 



๐ŸŒธ Day 37: Circular Chord Diagram in Python

On Day 37 of our data visualization journey, we created a true circular Chord Diagram with a soft, Pinterest-inspired aesthetic using Holoviews + Bokeh.

This visualization beautifully captures relationships between creative platforms and inspiration sources all wrapped in a dreamy pastel theme.


๐ŸŽฏ What We’re Visualizing

Our nodes:

  • Pinterest

  • Instagram

  • Design

  • Inspo

Our goal:
To visualize how these platforms and ideas connect and influence each other.

Unlike Sankey diagrams (which show directional flow), this chord diagram:

  • Arranges nodes in a circle

  • Connects them with curved ribbons

  • Highlights relationship strength

  • Feels balanced and visually aesthetic


๐Ÿ›  Step-by-Step Breakdown


✅ 1️⃣ Import Required Libraries

import holoviews as hv
from holoviews import opts
import pandas as pd
import numpy as np

hv.extension('bokeh')

We use:

  • Holoviews → For high-level interactive visualization

  • Bokeh backend → For rendering

  • Pandas → For structured data


✅ 2️⃣ Create Relationship Data

links = pd.DataFrame([ {'source': 'Pinterest', 'target': 'Design', 'value': 10},
{'source': 'Instagram', 'target': 'Design', 'value': 15},
{'source': 'Design', 'target': 'Inspo', 'value': 20},
{'source': 'Inspo', 'target': 'Pinterest', 'value': 5},
{'source': 'Instagram', 'target': 'Inspo', 'value': 12},
{'source': 'Design', 'target': 'Instagram', 'value': 8}, ])

Each row represents:

  • source → Starting node

  • target → Connected node

  • value → Strength of the relationship

The larger the value, the thicker the ribbon.


✅ 3️⃣ Define the Dreamy Color Palette

colors = ["#E5989B", "#B5838D", "#6D6875", "#DBC1AD"]
Soft pastel tones create:
  • Aesthetic appeal

  • Pinterest-style vibe

  • Visual harmony

Color choices dramatically affect storytelling and today’s goal was elegance.


✅ 4️⃣ Create the Chord Diagram

chord = hv.Chord(links)
This automatically:
  • Detects unique nodes

  • Arranges them in a circular layout

  • Draws curved connections


✅ 5️⃣ Apply Styling

chord.opts( opts.Chord( cmap=colors, edge_cmap=colors, edge_color=hv.dim('source').str(),
node_color=hv.dim('index').str(), labels='index', label_text_font='serif', edge_alpha=0.4, node_size=20, width=600, height=600, bgcolor='#FAF9F6'
)
)

✨ What This Styling Does:

  • cmap → Applies pastel colors

  • edge_color → Colors ribbons by source

  • node_color → Colors nodes uniquely

  • edge_alpha=0.4 → Soft transparent ribbons

  • bgcolor='#FAF9F6' → Linen aesthetic background

  • label_text_font='serif' → Elegant typography

This transforms a basic network into a brand-ready visualization.


✅ 6️⃣ Save as Interactive HTML

hv.save(chord, 'chord_chart.html')

This creates an interactive file where you can:

  • Hover over connections

  • Explore relationship strength

  • Zoom and inspect

Perfect for:

  • Portfolios

  • Presentations

  • Websites

  • LinkedIn posts


๐Ÿ“Š What the Visualization Reveals

  • Instagram strongly influences Design

  • Design heavily feeds into Inspiration

  • Inspiration loops back to Pinterest

  • Design and Instagram have mutual interaction

It visually tells a story of creative content flow.


๐Ÿ’ก Why Chord Diagrams Are Powerful

✔ Show interconnected systems
✔ Perfect for circular relationships
✔ Visually impactful
✔ Great for storytelling
✔ Ideal for brand-driven data aesthetics


๐Ÿ”ฅ Real-World Use Cases

  • Social media ecosystem analysis

  • Marketing channel relationships

  • Trade networks

  • Collaboration mapping

  • Content flow visualization


0 Comments:

Post a Comment

Popular Posts

Categories

100 Python Programs for Beginner (118) AI (209) Android (25) AngularJS (1) Api (7) Assembly Language (2) aws (28) Azure (8) BI (10) Books (262) Bootcamp (1) C (78) C# (12) C++ (83) Course (84) Coursera (299) Cybersecurity (29) data (1) Data Analysis (26) Data Analytics (20) data management (15) Data Science (303) Data Strucures (16) Deep Learning (125) Django (16) Downloads (3) edx (21) Engineering (15) Euron (30) Events (7) Excel (18) Finance (10) flask (3) flutter (1) FPL (17) Generative AI (63) Git (9) Google (48) Hadoop (3) HTML Quiz (1) HTML&CSS (48) IBM (41) IoT (3) IS (25) Java (99) Leet Code (4) Machine Learning (251) Meta (24) MICHIGAN (5) microsoft (9) Nvidia (8) Pandas (13) PHP (20) Projects (32) Python (1258) Python Coding Challenge (1046) Python Mistakes (50) Python Quiz (430) Python Tips (5) Questions (3) R (72) React (7) Scripting (3) security (4) Selenium Webdriver (4) Software (19) SQL (46) Udemy (17) UX Research (1) web application (11) Web development (8) web scraping (3)

Followers

Python Coding for Kids ( Free Demo for Everyone)