4

Pokemon Types with Plotapi Heat Map

 2 years ago
source link: https://datacrayon.com/posts/plotapi/showcase/pokemon-types-with-plotapi-heatmap/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Get the Books

Enjoying these notebooks and want to support the work? Check out the practical books on Data Science, Visualisation, and Evolutionary Algorithms.

Get the books
covertops.jpg

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.

Plotapi - Heat Map Diagram

BugDarkDragonElectricFairyFightingFireFlyingGhostGrassGroundIceNormalPoisonPsychicRockSteelWaterBugDarkDragonElectricFairyFightingFireFlyingGhostGrassGroundIceNormalPoisonPsychicRockSteelWaterProduced with PlotapiLocked - click/tap to unlockTypeGenName

Preamble

from plotapi import HeatMap
import json

HeatMap.set_license("your username", "your license key")

Introduction

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

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 Heat Map 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.

HeatMap(
    data["matrix"],
    col_names=names,
    row_names=names,
    details_thumbs=data["details_thumbs"],
    thumbs_width=50,
    thumbs_margin=1,
    popup_width=600,
    data_table_column_width=100,
    data_table=data["data_table"],
    data_table_show_indices=False
).show()

Plotapi - Heat Map Diagram

BugDarkDragonElectricFairyFightingFireFlyingGhostGrassGroundIceNormalPoisonPsychicRockSteelWaterBugDarkDragonElectricFairyFightingFireFlyingGhostGrassGroundIceNormalPoisonPsychicRockSteelWaterProduced with PlotapiLocked - click/tap to unlockTypeGenName

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.

Support this work

Get the practical book on data visualisation that shows you how to create static and interactive visualisations that are engaging and beautiful.

  • Discounted Price that will grow as the book does,
  • Code examples primarily in Python,
  • Python Notebooks for each Section,
  • Format: PDF download,
  • Supplementary Video Tutorials,
  • Unlimited access to updates.

Plotapi, beautiful by default.

Let plotapi do the heavy lifting – enabling beautiful interactive visualisations with a single line of code (instead of hundreds).

Get Plotapi
plotapi-chord-pokemon-simple.svg

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK