Skip to main content
`Ctrl`+`K`

# pandas.plotting.parallel_coordinates

pandas.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)

  Parallel coordinates plotting.

  This visualization technique represents each observation as a polyline connecting values across vertical axes, one for each feature. Lines are colored by class membership, making it useful for identifying clusters and separability in multivariate data.

  Parameters:
    frame DataFrame

      The DataFrame to be plotted.

    class_column str

      Column name containing class names.

    cols list, optional

      A list of column names to use.

    ax matplotlib.axis, optional

      Matplotlib axis object.

    color list or tuple, optional

      Colors to use for the different classes.

    use_columns bool, optional

      If true, columns will be used as xticks.

    xticks list or tuple, optional

      A list of values to use for xticks.

    colormap str or matplotlib colormap, default None

      Colormap to use for line colors.

    axvlines bool, optional

      If true, vertical lines will be added at each xtick.

    axvlines_kwds keywords, optional

      Options to be passed to axvline method for vertical lines.

    sort_labels bool, default False

      Sort class_column labels, useful when assigning colors.

    **kwargs

      Options to pass to matplotlib plotting method.

  Returns:
    matplotlib.axes.Axes

      The matplotlib axes containing the parallel coordinates plot.

  See also

  `plotting.andrews_curves`

    Generate a matplotlib plot for visualizing clusters of multivariate data.

  `plotting.radviz`

    Plot a multidimensional dataset in 2D.

  Examples

      >>> df = pd.DataFrame(
      ...     {
      ...         "SepalLength": [6.5, 7.7, 5.1, 5.8, 7.6, 5.0, 5.4, 4.6, 6.7, 4.6],
      ...         "SepalWidth": [3.0, 3.8, 3.8, 2.7, 3.0, 2.3, 3.0, 3.2, 3.3, 3.6],
      ...         "PetalLength": [5.5, 6.7, 1.9, 5.1, 6.6, 3.3, 4.5, 1.4, 5.7, 1.0],
      ...         "PetalWidth": [1.8, 2.2, 0.4, 1.9, 2.1, 1.0, 1.5, 0.2, 2.1, 0.2],
      ...         "Name": [
      ...             "virginica",
      ...             "virginica",
      ...             "setosa",
      ...             "virginica",
      ...             "virginica",
      ...             "versicolor",
      ...             "versicolor",
      ...             "setosa",
      ...             "virginica",
      ...             "setosa",
      ...         ],
      ...     }
      ... )
      >>> pd.plotting.parallel_coordinates(
      ...     df, "Name", color=("#556270", "#4ECDC4", "#C7F464")
      ... )