Data is Beautiful
A practical book on data visualisation that shows you how to create static and interactive visualisations that are engaging and beautiful.
Get the book
Animal Crossing Villagers - Species and Personalities
Contents Chat Share Follow Download Source
Made with Chord Pro
You can create beautiful interactive visualisations like this one with Chord Pro. Learn how to make beautiful visualisations with the book, Data is Beautiful.
Preamble¶
import numpy as np # for multi-dimensional containers
import pandas as pd # for DataFrames
import itertools
from chord import Chord
Introduction¶
In previous sections, we visualised co-occurrences of Pokémon type. Whilst it was interesting to look at, the dataset only contained Pokémon from the first six geerations. In this section, we're going to use the TidyTuesday Animal Crossing villagers dataset to visualise the relationship between Species and .
The Dataset¶
The dataset documentation states that we can expect 13 variables per each of the 1017 Pokémon of the first eight generations.
Let's download the mirrored dataset and have a look for ourselves.
data_url = 'https://shahinrostami.com/datasets/ac_villagers.csv'
data = pd.read_csv(data_url)
data.head()
id | name | gender | species | birthday | personality | song | phrase | full_id | url | |
---|---|---|---|---|---|---|---|---|---|---|
0 | admiral | Admiral | male | bird | Jan-27 | cranky | Steep Hill | aye aye | villager-admiral | https://shahinrostami.com/images/data-is-beaut... |
1 | agent-s | Agent S | female | squirrel | 07-Feb | peppy | DJ K.K. | sidekick | villager-agent-s | https://shahinrostami.com/images/data-is-beaut... |
2 | agnes | Agnes | female | pig | Apr-21 | uchi | K.K. House | snuffle | villager-agnes | https://shahinrostami.com/images/data-is-beaut... |
3 | al | Al | male | gorilla | Oct-18 | lazy | Steep Hill | Ayyeeee | villager-al | https://shahinrostami.com/images/data-is-beaut... |
4 | alfonso | Alfonso | male | alligator | 06-Sep | lazy | Forest Life | it'sa me | villager-alfonso | https://shahinrostami.com/images/data-is-beaut... |
capitalise the name, personality, and species of each villager.
data['name'] = data['name'].str.capitalize()
data['personality'] = data['personality'].str.capitalize()
data['species'] = data['species'].str.capitalize()
It looks good so far, but let's confirm the 13 variables against 1017 samples from the documentation.
data.shape
(391, 10)
Perfect, that's exactly what we were expecting.
Data Wrangling¶
We need to do a bit of data wrangling before we can visualise our data. We can see from the columns names that the Pokémon types are split between the columns Type 1
and Type 2
.
pd.DataFrame(data.columns.values.tolist())
0 | |
---|---|
0 | id |
1 | name |
2 | gender |
3 | species |
4 | birthday |
5 | personality |
6 | song |
7 | phrase |
8 | full_id |
9 | url |
So let's select just these two columns and work with a list containing only them as we move forward.
species_personality = pd.DataFrame(data[['species', 'personality']].values)
species_personality
0 | 1 | |
---|---|---|
0 | Bird | Cranky |
1 | Squirrel | Peppy |
2 | Pig | Uchi |
3 | Gorilla | Lazy |
4 | Alligator | Lazy |
... | ... | ... |
386 | Horse | Peppy |
387 | Wolf | Cranky |
388 | Koala | Snooty |
389 | Deer | Smug |
390 | Octopus | Lazy |
391 rows × 2 columns
Now for the names of our types.
left = np.unique(pd.DataFrame(species_personality)[0]).tolist()
pd.DataFrame(left)
0 | |
---|---|
0 | Alligator |
1 | Anteater |
2 | Bear |
3 | Bird |
4 | Bull |
5 | Cat |
6 | Chicken |
7 | Cow |
8 | Cub |
9 | Deer |
10 | Dog |
11 | Duck |
12 | Eagle |
13 | Elephant |
14 | Frog |
15 | Goat |
16 | Gorilla |
17 | Hamster |
18 | Hippo |
19 | Horse |
20 | Kangaroo |
21 | Koala |
22 | Lion |
23 | Monkey |
24 | Mouse |
25 | Octopus |
26 | Ostrich |
27 | Penguin |
28 | Pig |
29 | Rabbit |
30 | Rhino |
31 | Sheep |
32 | Squirrel |
33 | Tiger |
34 | Wolf |
right = np.unique(pd.DataFrame(species_personality)[1]).tolist()
pd.DataFrame(right)
0 | |
---|---|
0 | Cranky |
1 | Jock |
2 | Lazy |
3 | Normal |
4 | Peppy |
5 | Smug |
6 | Snooty |
7 | Uchi |
Which we can now use to create the matrix.
features= left+right
d = pd.DataFrame(0, index=features, columns=features)
Our chord diagram will need two inputs: the co-occurrence matrix, and a list of names to label the segments.
We can build a co-occurrence matrix with the following approach. We'll start by creating a list with every type pairing in its original and reversed form.
species_personality = list(itertools.chain.from_iterable((i, i[::-1]) for i in species_personality.values))
for x in species_personality:
d.at[x[0], x[1]] += 1
d
Alligator | Anteater | Bear | Bird | Bull | Cat | Chicken | Cow | Cub | Deer | ... | Tiger | Wolf | Cranky | Jock | Lazy | Normal | Peppy | Smug | Snooty | Uchi | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Alligator | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 2 | 2 | 1 | 0 | 0 | 1 | 0 |
Anteater | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 1 | 0 | 1 | 2 | 1 | 1 | 0 |
Bear | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 5 | 1 | 1 | 1 | 2 | 2 | 0 | 3 |
Bird | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 4 | 2 | 1 | 2 | 2 | 1 | 0 |
Bull | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 | 0 |
Cat | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 2 | 3 | 3 | 3 | 5 | 1 | 5 | 1 |
Chicken | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 1 | 2 | 1 | 0 | 1 | 2 | 1 |
Cow | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 2 | 0 |
Cub | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 2 | 2 | 4 | 4 | 2 | 0 | 1 | 1 |
Deer | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 1 | 2 | 1 | 0 |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| 4 | 1 |
Tiger | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 3 | 0 | 0 | 2 | 0 | 1 | 0 |
Wolf | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 5 | 0 | 0 | 1 | 1 | 1 | 3 | 0 |
Cranky | 1 | 1 | 5 | 1 | 3 | 2 | 1 | 0 | 2 | 1 | ... | 1 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Jock | 2 | 1 | 1 | 4 | 1 | 3 | 1 | 0 | 2 | 1 | ... | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Lazy | 2 | 0 | 1 | 2 | 2 | 3 | 2 | 0 | 4 | 2 | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Normal | 1 | 1 | 1 | 1 | 0 | 3 | 1 | 1 | 4 | 1 | ... | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Peppy | 0 | 2 | 2 | 2 | 0 | 5 | 0 | 1 | 2 | 0 | ... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Smug | 0 | 1 | 2 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | ... | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Snooty | 1 | 1 | 0 | 1 | 0 | 5 | 2 | 2 | 1 | 1 | ... | 1 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Uchi | 0 | 0 | 3 | 0 | 0 | 1 | 1 | 0 | 1 | 2 | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
43 rows × 43 columns
Chord Diagram¶
Time to visualise the co-occurrence of types using a chord diagram. We are going to use a list of custom colours that represent the types.
colors =["#ff2200","#ffcc00","#ace6cb","#0057d9","#633366","#73341d","#665f00","#00ffcc","#001433","#e6acda","#ffa280","#eeff00","#336663","#001f73","#ff00aa","#ffd9bf","#f2ffbf","#36ced9","#737399","#73003d","#ff8800","#44ff00","#00a2f2","#6600ff","#ff0044","#99754d","#416633","#004d73","#5e008c","#bf606c","#332200","#60bf60","#acd2e6","#e680ff","#66333a","#3d005c","#6e0060","#99005d","#bd0055","#db2f48","#f05738","#fc7e23","#ffa600"]
names = left + right
Finally, we can put it all together.
Chord(d.values.tolist(), names,colors=colors, wrap_labels=False, margin=40, font_size_large=10).show()
Chord(d.values.tolist(), names,credit=True, colors=colors, wrap_labels=False,
margin=40, font_size_large=7,noun="villagers",
details_separator="", divide=True, divide_idx=len(left),divide_size=.2, width=850).show()
Chord Diagram with Names¶
It would be nice to show a list of Pokémon names when hovering over co-occurring Pokémon types. To do this, we can make use of the optional details
parameter.
Next, we'll create an empty multi-dimensional array with the same shape as our matrix
.
details = np.empty((len(names),len(names)),dtype=object)
details_thumbs = np.empty((len(names),len(names)),dtype=object)
Now we can populate the details
array with lists of Pokémon names in the correct positions.
for count_x, item_x in enumerate(names):
for count_y, item_y in enumerate(names):
details_urls = data[
(data['species'].isin([item_x, item_y])) &
(data['personality'].isin([item_y, item_x]))]['url'].to_list()
details_names = data[
(data['species'].isin([item_x, item_y])) &
(data['personality'].isin([item_y, item_x]))]['name'].to_list()
urls_names = np.column_stack((details_urls, details_names))
if(urls_names.size > 0):
details[count_x][count_y] = details_names
details_thumbs[count_x][count_y] = details_urls
else:
details[count_x][count_y] = []
details_thumbs[count_x][count_y] = []
details=pd.DataFrame(details).values.tolist()
details_thumbs=pd.DataFrame(details_thumbs).values.tolist()
len(right)
8
Finally, we can put it all together but this time with the details
matrix passed in.
Chord(d.values.tolist(), names,credit=True, colors=colors, wrap_labels=False,
padding=0, font_size_large=10,details=details,details_thumbs=details_thumbs,noun="villagers",
details_separator="", divide=True, divide_idx=len(left),divide_size=.2, width=800).show()
np.empty(shape=(6,1)).tolist()
[[2.291755454583e-312], [2.22809558106e-312], [2.143215749443e-312], [2.37663528627e-312], [2.29175545472e-312], [0.0]]
d
Alligator | Anteater | Bear | Bird | Bull | Cat | Chicken | Cow | Cub | Deer | ... | Tiger | Wolf | Cranky | Jock | Lazy | Normal | Peppy | Smug | Snooty | Uchi | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Alligator | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 2 | 2 | 1 | 0 | 0 | 1 | 0 |
Anteater | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 1 | 0 | 1 | 2 | 1 | 1 | 0 |
Bear | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 5 | 1 | 1 | 1 | 2 | 2 | 0 | 3 |
Bird | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 4 | 2 | 1 | 2 | 2 | 1 | 0 |
Bull | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 | 0 |
Cat | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 2 | 3 | 3 | 3 | 5 | 1 | 5 | 1 |
Chicken | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 1 | 2 | 1 | 0 | 1 | 2 | 1 |
Cow | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 2 | 0 |
Cub | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 2 | 2 | 4 | 4 | 2 | 0 | 1 | 1 |
Deer | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 1 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 | 5 | 3 | 1 | 4 | 1 |
Tiger | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 1 | 3 | 0 | 0 | 2 | 0 | 1 | 0 |
Wolf | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... | 0 | 0 | 5 | 0 | 0 | 1 | 1 | 1 | 3 | 0 |
Cranky | 1 | 1 | 5 | 1 | 3 | 2 | 1 | 0 | 2 | 1 | ... | 1 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Jock | 2 | 1 | 1 | 4 | 1 | 3 | 1 | 0 | 2 | 1 | ... | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Lazy | 2 | 0 | 1 | 2 | 2 | 3 | 2 | 0 | 4 | 2 | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Normal | 1 | 1 | 1 | 1 | 0 | 3 | 1 | 1 | 4 | 1 | ... | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Peppy | 0 | 2 | 2 | 2 | 0 | 5 | 0 | 1 | 2 | 0 | ... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Smug | 0 | 1 | 2 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | ... | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Snooty | 1 | 1 | 0 | 1 | 0 | 5 | 2 | 2 | 1 | 1 | ... | 1 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Uchi | 0 | 0 | 3 | 0 | 0 | 1 | 1 | 0 | 1 | 2 | ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
43 rows × 43 columns
Conclusion¶
In this section, we demonstrated how to conduct some data wrangling on a downloaded dataset to prepare it for a chord diagram. Our chord diagram is interactive, so you can use your mouse or touchscreen to investigate the co-occurrences!
Made with Chord Pro
You can create beautiful interactive visualisations like this one with Chord Pro. Learn how to make beautiful visualisations with the book, Data is Beautiful.
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.
Data is Beautiful
A practical book on data visualisation that shows you how to create static and interactive visualisations that are engaging and beautiful.
Get the book