Skip to main content

A library for ploting chord diagrams

Project description

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 /example directory

  1. Quick Start

    • First chord diagram
    • Radius
    • Padding
    • Font size and font family
    • Colormap
    • Gap size
    • Background color and
  2. The Logo

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openchord-0.1.6.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openchord-0.1.6-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file openchord-0.1.6.tar.gz.

File metadata

  • Download URL: openchord-0.1.6.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for openchord-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e520a7f692e6e8f5f607a07a0e2ae115dfc7a4debcebd491b32713ca69db55b9
MD5 4e1fb1353b5db4ef6056c4ab0319be58
BLAKE2b-256 1c7b588624fe808b96ecdf09a094cc97758b1a9bf82a7c64ac2b54fc6c6e137e

See more details on using hashes here.

File details

Details for the file openchord-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: openchord-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for openchord-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d72b5f0f9af9540578ed6d66415afdaab21a7248593889cc25c3c6fc20c5bb1c
MD5 b64f358af3c325958f85ffb913ee98fd
BLAKE2b-256 2038c9add254d41e0b3b27ac2c54ef0a5e6f95f2a9b50d5460fa8f1365ec0ce4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page