Visualizations Showcase
IMDb Top 1000 with Chord
In this notebook we're going to use PlotAPI Chord to visualise the co-occurrences of genres in the IMDb "Top 1000" (Sorted by IMDb Rating Descending). We"ll use Python, but PlotAPI can be used from any programming language.
Preamble
from plotapi import Chord
import json
Introduction
In this notebook we're going to use PlotAPI Chord to visualise the co-occurrences of genres in the IMDb "Top 1000" (Sorted by IMDb Rating Descending). 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 the latest IMDB top 1000 data which is available on their website. Let"s get loading the data.
with open("imdb_top_1000.json", "r") as f:
data = json.load(f)
names = ['Action', 'Adventure', 'Animation', 'Biography', 'Comedy',
'Crime', 'Drama', 'Family', 'Fantasy', 'Film-Noir',
'History', 'Horror', 'Music', 'Musical', 'Mystery',
'Romance', 'Sci-Fi', 'Sport', 'Thriller', 'War', 'Western']
Visualisation
Let's use PlotAPI Chord for this visualisation, you can see more examples in the Showcase.
We're going to adjust some layout and template parameters, and flip the intro animation on too. We'll also configure the data table to hide the indices, and we'll make sure to compress our data table so we have a smaller output size. Finally, we've also set data_table_unique_column="Name"
, because we have instances where a title has 3 or more genres, and we don't want them to appear multiple times in the same data table selection.
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="movies",
noun="titles",
data_table_column_width=100,
data_table_unique_column="Name",
data_table_show_indices=False,
compress=True,
data_table=data["data_table"],
width=600,
label_style="star",
)
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="IMDb Top 1000 Genre Combinations",
description='''In this project we're going to use PlotAPI Chord to visualise the co-occurrences of genres in the IMDb "Top 1000" (Sorted by IMDb Rating Descending).''',
maximized=True,
full_width=True,
public=True,
custom_css=custom_css
)