Engaging plots, made easy.

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

main.py
notebook.ipynb
main.rs
from plotapi import Chord

Chord(matrix, names).show()

Visualizations Showcase

Pokemon Types with Chord

In this notebook we're going to use PlotAPI Chord to visualise the co-occurrences between Pokémon types. We"ll use Python, but PlotAPI can be used from any programming language.


Preamble

import json

from plotapi import Chord

Introduction

In this notebook we're going to use PlotAPI Chord to visualise the co-occurrences between Pokémon types. We"ll use Python, but PlotAPI can be used from any programming language.

In a chord diagram (or radial network), entities are arranged radially as segments with their relationships visualised by ribbons that connect them. The size of the segments illustrates the numerical proportions, whilst the size of the arc illustrates the significance of the relationships. Chord diagrams are useful when trying to convey relationships between different entities, and they can be beautiful and eye-catching.

Dataset

We're going to use Pokémon (Gen 1-8) data, a fork of which is available in this repository. Let"s get loading the data.

with open("pokemon_types.json", "r") as f:
    data = json.load(f)
    
names = ["Bug", "Dark", "Dragon", "Electric", "Fairy", "Fighting",
         "Fire", "Flying", "Ghost", "Grass", "Ground", "Ice",
         "Normal", "Poison", "Psychic", "Rock", "Steel", "Water"]

Visualisation

Let's use PlotAPI Chord for this visualisation.

We're going to adjust some layout and template parameters, and flip the intro animation on too.

Because we're using a data-table, we can also click on any part of the diagram to "lock" the selection.

plot = Chord(
    data["matrix"],
    names,
    colors="monsters",
    details_thumbs=data["details_thumbs"],
    width=650,
    noun="Pokemon!",
    thumbs_width=50,
    curved_labels=True,
    thumbs_margin=1,
    popup_width=600,
    arc_numbers=True,
    data_table_column_width=100,
    data_table=data["data_table"],
    data_table_show_indices=False,
    large_font_size=16,
    font_size=16
)

Display inline

plot

Upload to cloud

With our plot created, let's upload it to PlotAPI cloud and get a shareable link.

plot.upload(
    name="Pokémon Types (Gen 1-9)",
    description='''In this project we're going to use PlotAPI to visualize the co-occurrences between Pokémon types. We're going to use Pokémon (Gen 1-9) data, a fork of which is available in @shahinrostami's GitHub.''',
    maximized=True,
    full_width=True,
    public=True,
    custom_css=custom_css
)
Your visualization has been uploaded successfully! You can view and share it at https://plotapi.com/explore/view/4210906f-1ecf-4647-a04a-9b7784e3435c.
Previous
Showcase