Multivariate comparison
Compare multiple numeric measurements across observations.
Plotly · Function
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.
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.
px.parallel_coordinates(data_frame=None, dimensions=None, color=None, labels=None, color_continuous_scale=None, color_continuous_midpoint=None, **kwargs)| Name | Type | Description |
|---|---|---|
data_frame | DataFrame or array-like | Data frame or compatible columnar data source containing the fields to plot. |
color | str or array-like | Column used to assign continuous colors to the polylines. |
dimensions | list of str | Ordered list of columns to represent as parallel axes. |
labels | dict | Mapping from source field names to displayed labels. |
color_continuous_scale | list or named colorscale | Continuous colorscale used for the color encoding. |
color_continuous_midpoint | number | Numeric midpoint for the continuous color scale. |
A Plotly Figure object containing the parallel-coordinates chart.
dimensions to explicitly choose and order the columns shown as axes.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.
Compare multiple numeric measurements across observations.
Explore relationships and identify clusters or outliers interactively.
Inspect how a numeric outcome varies across several selected features.
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.
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.
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.expresspx.parallel_categoriespx.scatter_matrixplotly.graph_objects.Parcoords