Visualizations Showcase
IMDb Top 1000 with Heat Map
In this notebook we're going to use PlotAPI Heat Map 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 HeatMap
import json
Introduction
In this notebook we're going to use PlotAPI Heat Map 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.
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 HeatMap 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 = HeatMap(
data["matrix"],
row_names=names,
col_names=names,
colors="turbo",
zero_color="transparent",
noun="movies",
width=600,
data_table=data["data_table"],
data_table_column_width=100,
data_table_unique_column="Name",
data_table_show_indices=False,
compress=True,
)
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 HeatMap 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
)