Skip to main content

OpenChord

OpenChord is a Python library I am developing to plot beautiful chord diagrams for visualising networks and graphs. OpenChord uses the drawsvg library and can display figures in a Jupyter notebook or Jupyter lab. Other libraries for drawing chord diagram includes PlotAPI (paid), Bokeh (visible moire artifact), and Plotly (tedious).

Installation

OpenChord is now on PyPI.org! Install using the command

pip install openchord

Usage

Currently, the function only support symmetric adjacency matricies (i.e. weighted graph, non-directed)

import openchord as ocd

adjacency_matrix = [[ 3, 18,  9,  0, 23],
                    [18,  0, 12,  5, 29],
                    [ 9, 12,  0, 27, 10],
                    [ 0,  5, 27,  0,  0],
                    [23, 29, 10,  0,  0]]
labels = ['Emma', 'Isabella', 'Ava', 'Olivia', 'Sophia']

fig = ocd.Chord(adjacency_matrix, labels)
fig.show()

Color can be changed like so

fig.colormap = ['#636EFA', '#EF553B', '#00CC96', '#AB63FA', '#FFA15A', '#19D3F3', '#FF6692', '#B6E880', '#FF97FF', '#FECB52']
fig.show()

You can export the figure as an .svg file and open it in a vector graphics software such as Inkscape

fig.save_svg("figure.svg")

Chord diagram using OpenChord

More tutorials and examples

I wrote a few more tutorials available via the link below and in the /examples directory. Feel free to download them and run it yourself.

  1. Quick Start

    • First chord diagram
    • Radius
    • Padding
    • Font size and font family
    • Colormap
    • Gap size
    • Background color and transparancy
  2. The Logo (The text is not centered vertically when viewed on GitHub)

    • Rotation
    • Custom plot area
    • Gradient style
    • Arc thickness
    • Text position
    • Ribbon gap
    • Ribbon stiffness
    • Save as SVG

Metadata

Release files for openchord 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openchord 0.1.7
File Size Uploaded
openchord-0.1.7.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openchord 0.1.7
File Interpreter ABI Platform
openchord-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / openchord-0.1.7.tar.gz

Download URL openchord-0.1.7.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e96760902083607bff6dfdb7e85eb2308528f059f37f8722cbf876c5ba072520
BLAKE2b-256 checksum
How to use checksums
8e2ce4f2720b66398270baebc2f4f3287992c51d34f9677db6d24e65fd9a44c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / openchord-0.1.7-py3-none-any.whl

Download URL openchord-0.1.7-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88a3db6e81c86f8b2723c29bd8d456b52a59692af86b11ce4c9190f2f9bb0efd
BLAKE2b-256 checksum
How to use checksums
2aa4183af26f158e6edc041fdebb7a396c6b0155e5565455098ea96b6cde2b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page