Source

Adapted from my own handwritten and hand-typed notes from Year 1 to Year 3 of my EEE degree

Multivariate exploration handles several numeric variables at once, e.g. HP, Attack, Defense, Sp. Atk, Sp. Def and Speed.

Steps

A typical order:

  • individual summaries with describe() for each variable
  • side by side box plots, histograms and violin plots to compare distributions
  • the full correlation matrix and heatmap to see mutual correlations
  • a pair plot to see every pair at once

Correlation Heatmap

Each cell is the correlation of two variables, coloured from to . The diagonal is always 1. It quickly shows which pairs move together and which are unrelated.

Pair Plot

A pair plot is a grid of plots:

  • diagonal: histogram of each variable (its own distribution)
  • off diagonal: scatter plot of each pair (inter-variable dependence)

Code

cols = ['HP', 'Attack', 'Defense', 'Sp. Atk', 'Sp. Def', 'Speed']
numDF = pd.DataFrame(pkmndata[cols])
 
numDF.describe()
f = plt.figure(figsize=(16, 8))
sb.boxplot(data=numDF, orient='h')
 
f = plt.figure(figsize=(12, 12))
sb.heatmap(numDF.corr(), vmin=-1, vmax=1, annot=True, fmt='.2f')
 
sb.pairplot(data=numDF)

The diagonal histograms are read just like those in Univariate Visualisation.