Plot parallel coordinates in Matplotlib


To plot parallel coordinates, we can take the following Steps −

  • Load dataset iris using Seaborn (Need internet).

  • Pass the loaded data into the parallel_coordinates() method, which will help in parallel plotting.

  • To display the figure, use the show() method.

Example

import matplotlib.pyplot as plt
from pandas.plotting import parallel_coordinates
import seaborn as sns
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
data = sns.load_dataset('iris')
parallel_coordinates(data, 'species', colormap=plt.get_cmap("Set2"))
plt.show()

Output

Updated on: 09-Apr-2021

323 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements