Parallel Plot using Pandas

logo of a chart:Parallel1

This post shows how to build a parallel plot using the pandas python library.

You can draw a parallel plot using pandas library of the python with the parallel_coordinates() function. In the example below, the following arguments are passed to the function:

  • data : data frame
  • class_column : column name containing class names
  • colormap : colormap to use for line colors
# libraries
import pandas
import matplotlib.pyplot as plt
import seaborn as sns
from pandas.plotting import parallel_coordinates
 
# Take the iris dataset
data = sns.load_dataset('iris')
 
# Make the plot
parallel_coordinates(data, 'species', colormap=plt.get_cmap("Set2"))
plt.show()

Contact & Edit


👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥

This page is just a jupyter notebook, you can edit it here. Please help me making this website better 🙏!