pandas.plotting.andrews_curves

pandas 3.1.1 · Plotting · function

Plot each record as a curve created from its numeric features and optionally color curves by class.

Call syntax

pd.plotting.andrews_curves(…) Full signature
pd.plotting.andrews_curves(
    frame,
    class_column,
    ax=None,
    samples=200,
    color=None,
    colormap=None,
    **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
label

Provide the column indicating the class or group plotted.

ax Optional
Positional or keyword
Default None
axes object

Provide the existing Matplotlib axes on which to draw.

samples Optional
Positional or keyword
Default 200
int
color Optional
Positional or keyword
Default None
str, list[str] or tuple[str]

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

colormap Optional
Positional or keyword
Default None
str or matplotlib colormap object

Choose the color map used by the chart.

**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.andrews_curves(frame, "team"))