1

I have a dataframe with stats from Pokemon and try to compare the stats from the different types. I want to show it in a parallel coordinate chart with 2 different types in a multiplot.
Actually I'm using parallel_coordinates() from pandas for the chart and tried to use plt.subplot() from matplotlib for the multiplot. The problem is I cant declare in what axes I want to draw the values. Is it possible to draw with pandas a multiplot too? Or can I use the matplotlib for this?

This was my first attempt:

import pandas as pd
import matplotlib.pyplot as plt

values = \['Attack', 'Defense', 'HP', 'Sp.Attack', 'Sp.Defense', 'Speed'\]

fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(15,5))
fig.tight_layout()

df_fireWater = df_pokemon\[(df_pokemon\['Primary Type'\] == 'FIRE') | (df_pokemon\['Primary Type'\] == 'WATER')\]
ax1 = pd.plotting.parallel_coordinates(df_fireWater, 'Primary Type', values, color=('red', 'blue'))

df_waterPsychic = df_pokemon\[(df_pokemon\['Primary Type'\] == 'WATER') | (df_pokemon\['Primary Type'\] == 'PSYCHIC')\]
ax2 = pd.plotting.parallel_coordinates(df_fireWater, 'Primary Type', values, color=('blue', 'violet'))

df_waterRock = df_pokemon\[(df_pokemon\['Primary Type'\] == 'WATER') | (df_pokemon\['Primary Type'\] == 'ROCK')\]
ax3 = pd.plotting.parallel_coordinates(df_fireWater, 'Primary Type', values, color=('blue', 'brown'))

When I run my code everything will be drawn in the last chart and the first two are empty. Does anyone know how I can solve my problem?

Vanna
  • 13
  • 2
  • See also https://stackoverflow.com/questions/8230638/parallel-coordinates-plot-in-matplotlib – JohanC Dec 18 '22 at 09:54

0 Answers0