Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Plotly · Function

px.parallel_coordinates

px.parallel_coordinates creates an interactive parallel-coordinates plot from tabular data. Rows become polylines, while selected dimensions become parallel axes and an optional continuous field controls line color.

How it works

The function converts rows of a data frame into polylines that cross parallel axes, with one axis per selected dimension. You can choose the dimensions, color lines continuously, relabel fields, and then display or further customize the returned figure.

Syntax

px.parallel_coordinates(data_frame=None, dimensions=None, color=None, labels=None, color_continuous_scale=None, color_continuous_midpoint=None, **kwargs)

Parameters

NameTypeDescription
data_frameDataFrame or array-likeData frame or compatible columnar data source containing the fields to plot.
colorstr or array-likeColumn used to assign continuous colors to the polylines.
dimensionslist of strOrdered list of columns to represent as parallel axes.
labelsdictMapping from source field names to displayed labels.
color_continuous_scalelist or named colorscaleContinuous colorscale used for the color encoding.
color_continuous_midpointnumberNumeric midpoint for the continuous color scale.

Returns

A Plotly Figure object containing the parallel-coordinates chart.

Key points

  • Every data-frame row is drawn as one polyline crossing the chart’s parallel axes.
  • The plotted axes correspond to the fields selected as dimensions.
  • Use dimensions to explicitly choose and order the columns shown as axes.
  • The generated figure supports built-in interaction without requiring extra event-handling code.
  • A continuous color scale can be supplied to control how numeric line-color values are rendered.

Common mistakes

  • Filtering is interactive: users can drag along an axis, so displayed data may be temporarily restricted by selections.

Example: Interactive Iris parallel coordinates

import plotly.express as px

df = px.data.iris()
fig = px.parallel_coordinates(
    df,
    color="species_id",
    dimensions=["sepal_width", "sepal_length", "petal_width", "petal_length"],
    labels={"species_id": "Species"},
    color_continuous_scale=px.colors.diverging.Tealrose,
    color_continuous_midpoint=2,
)
fig.show()

Creates an interactive parallel-coordinates figure from the Iris dataset, using selected numeric columns as axes and a continuous color encoding.

When to use it

Multivariate comparison

Compare multiple numeric measurements across observations.

Exploratory data analysis

Explore relationships and identify clusters or outliers interactively.

Feature and outcome analysis

Inspect how a numeric outcome varies across several selected features.

Interview questions

QHow does px.parallel_coordinates represent tabular data?

Each input row becomes a polyline, and each selected dimension contributes one parallel axis. The result is a Plotly figure that can be displayed with fig.show() or customized further.

Follow-up: How would you reduce visual clutter? Explicitly pass a focused dimensions list, and consider filtering or aggregating the source data before plotting.

QHow do you control which axes appear?

Pass the column names through the dimensions argument. This selects which data-frame columns become axes instead of relying on the broader input data.

Follow-up: How can axis labels differ from source column names? Supply a labels mapping that associates each field name with its display label.

QHow is line color configured?

The color argument identifies the field used for line coloring, while color_continuous_scale selects the scale and color_continuous_midpoint sets its midpoint. Parallel-coordinates plots use continuous color scales.

Follow-up: How can categorical-looking groups be shown? Encode the groups numerically and use a custom stepped continuous scale with repeated normalized positions.

  • plotly.express
  • px.parallel_categories
  • px.scatter_matrix
  • plotly.graph_objects.Parcoords

Source: Parallel coordinates plot in Python. Checked 2026-10-15.