pandas.plotting.parallel_coordinates

pandas 3.1.1 · Plotting · function

Plot each observation as a line across multiple variable axes, grouped by class.

Call syntax

pd.plotting.parallel_coordinates(…) Full signature
pd.plotting.parallel_coordinates(
    frame,
    class_column,
    cols=None,
    ax=None,
    color=None,
    use_columns=False,
    xticks=None,
    colormap=None,
    axvlines=True,
    axvlines_kwds=None,
    sort_labels=False,
    **kwargs,
)

Inspect the call

Run this code to inspect the callable and its parameters. Its data, backend, or environment is needed to execute the operation itself.

Parameters

ParameterRequirementAccepted values and behavior
frame Required
Positional or keyword
DataFrame

Supply the DataFrame the function processes.

class_column Required
Positional or keyword
str

Provide the column indicating the class or group plotted.

cols Optional
Positional or keyword
Default None
list
ax Optional
Positional or keyword
Default None
matplotlib.axis

Provide the existing Matplotlib axes on which to draw.

color Optional
Positional or keyword
Default None
list or tuple

Choose the color or colors for the plot or styled cells.

use_columns Optional
Positional or keyword
Default False
bool
xticks Optional
Positional or keyword
Default None
list or tuple
colormap Optional
Positional or keyword
Default None
str or matplotlib colormap

Choose the color map used by the chart.

axvlines Optional
Positional or keyword
Default True
bool
axvlines_kwds Optional
Positional or keyword
Default None
keywords
sort_labels Optional
Positional or keyword
Default False
bool
**kwargs Optional
Additional keyword arguments

Returns

matplotlib.axes.Axes

Example for a local Python session

import pandas as pd
import matplotlib
frame = pd.DataFrame({"team": ["A", "A", "B"], "units": [2., 5., 7.], "price": [4., 3., 2.]})
print(pd.plotting.parallel_coordinates(frame, "team"))