Skip to content
Tutorials Center
My learning

Topics

Lesson 18 of 42 ยท Statistical and Scientific Charts

Scatter Matrix, Parallel Coordinates and Radar Charts

Explore many variables at once in Plotly: scatter matrix (SPLOM), parallel coordinates and parallel categories with brushing, and radar charts with line_polar and Scatterpolar.

A scatter plot shows two variables. Real datasets have many: a flower has four measurements, a car has a dozen specifications, a patient has dozens of test results. This lesson covers the charts built for multivariate exploration: the scatter matrix (all pairs at once), parallel coordinates and parallel categories (one line per observation across many axes), and the radar chart (profiles on a circle).

They are exploration tools. They help you notice which variables separate groups, which are redundant and which observations are unusual, before you build a model or write a report.

Scatter matrix (SPLOM)

A scatter matrix, also called a scatter plot matrix or SPLOM, is a grid. Every cell is a scatter plot of two variables, and the diagonal shows each variable against itself (usually as a histogram or as nothing at all). With four variables you get a 4 x 4 grid of plots, 16 cells, in which you can see every pairwise relationship at once.

Python px.scatter_matrix on the iris data

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

One splom trace per species holds all four dimensions. Because the matrix is symmetric (the cell for x vs y is the mirror of y vs x), hiding the upper half and the diagonal saves space and removes duplicates. In the figure, petal length against petal width shows three well-separated clusters, while the sepal variables overlap: this tells you at a glance which measurements are useful for telling species apart.

Tips: keep it to about 4 to 8 variables (more makes cells tiny), reduce marker size and add opacity for dense data, and use labels={...} to give short axis names. Click and drag with the box-select tool in one cell, and the same points are highlighted in all cells.

Parallel coordinates

In a parallel coordinates plot each variable is a vertical axis, and every observation is a line that crosses all axes at its values. Lines with similar paths form groups. Color usually shows one chosen variable or the class.

You can brush an axis by dragging a range on it: only the lines passing through that range stay colored, so you can ask "what do the observations with a high petal length have in common?"

Parallel coordinates with a preset filter

The preset constraintrange on the power axis keeps only cars with 100 to 200 hp. Drag on any axis (or click it to remove the filter) to try other questions. The pattern is typical: heavy cars have high power and price but low mileage.

In Express, px.parallel_coordinates(df, dimensions=[...], color="col", color_continuous_scale=...) does the same from a DataFrame. Its colors must be numeric; for a categorical class such as species, map it to numbers first (the species_id column in the iris dataset exists for this).

Python Express parallel coordinates and categories

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Parallel categories (also called alluvial or parallel sets) is the version for categorical variables: each axis lists categories, and ribbons between neighbors have a thickness proportional to the number of observations. It reads like a flow: "Sunday dinner smokers more often paid over 20".

Radar charts

A radar (spider) chart draws one variable per spoke of a wheel and connects a profile's values into a polygon. It compares a few profiles across 5 to 8 measures, such as skills of candidates or product ratings. In Plotly it is a polar chart: px.line_polar or go.Scatterpolar, with r for the value and theta for the spoke.

Python A radar chart in Python

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The polygon must be closed by repeating the first point (line_close=True does it in Express). Radar charts are easy to misuse: the polygon area depends on the order of the spokes, scales must be comparable, and more than three profiles become unreadable. Use them for a few profiles over a few comparable measures. For anything more, a grouped bar chart or a heatmap works better.

Choosing a multivariate chart

Goal Chart
Which pairs of variables are related? Scatter matrix, or a correlation heatmap
Which observations are similar across many variables? Parallel coordinates
How do categorical variables relate? Parallel categories
Compare a few profiles on a few measures Radar chart (or grouped bars)

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. In a 4-variable scatter matrix, how many cells does the full grid have?

    4 x 4 = 16 cells. Because the grid is symmetric you can hide the upper half and the diagonal, leaving 6.
  2. 2. What does each line represent in a parallel coordinates plot?

    Each vertical axis is a variable, and each observation is a line crossing all of them.
  3. 3. What is constraintrange used for?

    constraintrange filters lines to those passing through the range; users can also drag to set it.
  4. 4. How do you close a radar polygon in Plotly?

    A polar line trace is open unless you repeat the first value or ask Express to close it.
  5. 5. Which chart suits several categorical variables with flows between categories?

    Parallel categories draws ribbons whose thickness is proportional to the number of observations.

Summary

  • A scatter matrix shows every pair of variables; hide the upper half and diagonal to save space.
  • Parallel coordinates draw one line per observation across axes and support brushing; parallel categories do the same for categorical data.
  • Radar charts compare a few profiles over a few measures; close the polygon and keep scales comparable.
  • These are exploration tools: use them to find patterns, then confirm with simpler charts.

Next: Layout: Title, Size and Margins