Support this work
You can support this work by getting the e-books. This notebook will always be available for free in its online format.
from plotapi import Chord import json Chord.set_license("your username", "your license key")
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.
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"]
Let's use Plotapi Chord for this visualisation, you can see more examples in the Gallery.
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.
Chord( data["matrix"], names, colors="monsters", details_thumbs=data["details_thumbs"], margin=30, 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"], animated_intro=True ).show()