Skip to main content

A library for plotting chord diagrams.

Project description

RaChord

RaChord is a maintained fork of the original openchord library for visualising networks and graphs.

It 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

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

pip install rachord

Usage

The chord diagram is defined by an adjacency matricies (possibly non-symmetric)

import rachord 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 RaChord

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
    • 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
    • Gap size
    • 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

rachord-0.2.0.tar.gz (179.4 kB view details)

Uploaded Source

Built Distribution

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

rachord-0.2.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file rachord-0.2.0.tar.gz.

File metadata

  • Download URL: rachord-0.2.0.tar.gz
  • Upload date:
  • Size: 179.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for rachord-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9591fbe04ae8c930bb0609266d0a6946304ffa3963b4dc62f53c9c2accb85f51
MD5 66758e4029e3dc1bb73cc501db2e3fd6
BLAKE2b-256 350508bfe69ed768ca4af90183979e55e8bb723fc817021ee17a1675d3ad20f6

See more details on using hashes here.

File details

Details for the file rachord-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rachord-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for rachord-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63d08db898e78fede50a568b4c27ac9e1dcb7b52e4ea72a682aec37832b29168
MD5 35d03318c4600f66b8be9f5db0cc781d
BLAKE2b-256 e1b997408b7b110d30e6f7f392f6eb7bf081591ece85bdfcb6b24f5e6b070651

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