Parallel coordinate plot
A parallel plot plot allows to compare the feature of several individual observations (series) on a set of numeric variables. Interestingly, Pandas
is probably the best way to plot a parallel coordinate plot with python. Plotly
is a good alternative to plot interactive versions though.
⏱ Quick start
Pandas
is probably the best way to make a parallel coordinate plot. This library is most often used for data wrangling, but it offers a parallel_coordinates()
function dedicated to it.🔥
# libraries
import pandas
import matplotlib.pyplot as plt
from pandas.tools.plotting import parallel_coordinates
# Take the iris dataset
import seaborn as sns
data = sns.load_dataset('iris')
# Make the plot
parallel_coordinates(data, 'species', colormap=plt.get_cmap("Set2"))
plt.show()
Parallel coordinate chart with Python
and Pandas
The following examples are dedicated to the parallel_coordinates()
function of Pandas
. It shows how to apply the most common types of customization.
If you need to go further, here is the complete pandas documentation
Interactive parallel coordinate with plotly
Plotly
is a python library that makes the link with Javascript to build interactive charts that you can display in a browser.
The following example is a parallel chart made with this library and the parallel_coordinates()
function.
Contact
👋 This document is a work by Yan Holtz. Any feedback is highly encouraged. You can fill an issue on Github, drop me a message onTwitter, or send an email pasting yan.holtz.data
with gmail.com
.