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 BarFight import json BarFight.set_license("your username", "your license key")
In this notebook we're going to use Plotapi Bar Fight to visualise Pokémon search trends over time. We"ll use Python, but Plotapi can be used from any programming language.
The core games are released in generations, each with different Pokémon. We'll include remakes and one popular spin-off - Pokémon Go!
The "Interest over time" was retrieved for every Pokemon from Google Trends, for each month between 2004 and 2021. Pikachu was consistently the most popular, so Pikachu was always used as the reference point for every Pokemon. What we're seeing in the plot is the cumulative sum over time.
 Interest over time Numbers represent search interest relative to the highest point on the chart for the given region and time. A value of 100 is the peak popularity for the term. A value of 50 means that the term is half as popular. A score of 0 means there was not enough data for this term.
with open("pokemon_trends.json", "r") as f: data = json.load(f) samples = data['samples'] nodes = data['nodes'] events = data['events'] icon_base_url = "https://datacrayon.com/images/data-is-beautiful/pokemon_thumbs/"
Let's use Plotapi Bar Fight for this visualisation, you can see more examples in the Gallery.
We're going to adjust some layout and template parameters. These include:
event_pause=False: The visualisation won't pause every time an event is displayed.
top_n=30: By default, we'll only show 30 bars. We can add/remove bars ourselves by hovering over the visualisation and clicking the
icon_padding=-20: Why a negative number? For this visualisation, as they have transparent backgrounds, I thought it would look nicer to have the Pokemon popping out of their bars.
BarFight(samples, nodes=nodes, events=events, icon_base_url=icon_base_url, event_pause=False, width=1000, height=1000, icon_padding=-20, top_n=30, interval=750, background_color="white", border="10px solid black").show()