Engaging plots, made easy.

Easily turn your data into engaging visualizations. Powerful API for coders. Powerful app for everyone.

from plotapi import Chord

Chord(matrix, names).show()

Visualizations Chord

Layout properties

The title, width, margin, position, and rotation can be changed with these layout properties.

Sample data

Let's import PlotAPI and load our sample data.

from plotapi import Chord

matrix = [
    [0, 5, 6, 4, 7, 4],
    [5, 0, 5, 4, 6, 5],
    [6, 5, 0, 4, 5, 5],
    [4, 4, 4, 0, 5, 5],
    [7, 6, 5, 5, 0, 4],
    [4, 5, 5, 5, 4, 0],

names = ["Action", "Adventure", "Comedy", "Drama", "Fantasy", "Thriller"]


We can modify the width, margin, and rotation of our diagram.

The width parameter will also set the height, as the PlotAPI Chord maintains a 1:1 ratio. The callout label style automatically adjusts the height for better presentation.

The margin parameter expects a single float to imply an equal margin of that size.

The rotate paramater will rotate the Chord diagram around its center.

To include a diagram title, we can pass the desired string into the title parameter.

By default a Chord diagram is centered, but this can be disabled with center=False.

With a title

Chord(matrix, names, colors="warm",
      title="Movie Genre Co-occurrence").show()
PlotAPI - Chord Diagram

With layout properties

Chord(matrix, names, colors="cool",
      width=500, margin=50, rotate=-30).show()

Without layout properties

Chord(matrix, names, colors="cool").show()
PlotAPI - Chord Diagram