Color by Group or Color by Row? Partition vs Row Colors in Stratum
Coloring by continent can mean "analyze each continent separately" or just "make Africa orange." Stratum keeps those apart — and lets you use both.
gapminder — 142 countries every five years, 1952–2007. Download the file (the data behind The Gap That Closed). In Organize ▸ Filter, Keep rows where year is one of 1952, 2007, and add a column with Data ▸ Add Column…: log_gdp = log10([gdpPercap]).Requires Stratum 1.5 for row colors, markers and Color by Column.
"Color the points by continent" is two requests in the same words. One is analytical: treat each continent as a group — its own fit, its own correlation, a keyed legend. The other is cosmetic: make these rows look different, wherever they appear. Stratum has a tool for each — the chart's Partition and the row's own color and marker — and they compose.
Partition: groups the chart computes on
Make a Charts ▸ Relationship ▸ Scatter with X Columns = log_gdp, Y Columns = lifeExp, Gallery = year, and Partition = continent. Each continent takes a color and the legend keys it. Then open Trend, set Fit to Linear and tick Each Sub-Group; under Correlation, tick Pearson and Per Group.
Now the partition is doing statistics. In the 2007 panel the continents' own lines rise by roughly 10–12 years of life expectancy per tenfold income, while one line through all the points rises about 17 — part of the pooled gradient is between continents, not within them. The per-group correlations make the same point: about 0.45 in Africa, about 0.84 in Europe. (Oceania's two countries are too few to fit.)
A partition's colors are also stable across a gallery: a continent is the same color in the 1952 panel and the 2007 panel, even in a panel where some level has no rows. And they come from the column: set each level's color and marker once under Column Definition ▸ Colors & Markers, and every chart partitioned by continent follows. Symbols by Group (in the inspector's Display section) adds a shape per group.
Row colors: a property of the row
A row's color and marker belong to the row — like a mark. They are cosmetic: nothing is fitted or tested per color. You set them three ways:
- Data ▸ Rows ▸ Color or Marker on the rows selected in the data sheet — a named color, Custom…, or a shape.
- Right-click a point: the same Color and Marker submenus, applied to the rows behind it.
- Data ▸ Rows ▸ Color by Column… (and Marker by Column…): every row takes its level's color, live — edit the column and the colors follow. A measurement is shaded on a gradient between the Lowest: and Highest: colors you pick.
Because they live on the row, they show up on every point chart in the file — Scatter, Bubble, Trend, Q-Q, Box-Whisker points, Dot/Strip, Parallel Plot, PCA Biplot, the regression plots, the control charts — and in the data sheet's row gutter as a stripe and a shape. Bars, boxes, bins and wedges keep their own colors. You can filter on them (row color is, row marker is) and select by them (Select Rows with This Color).
Coloring a set of rows you dragged over
In the data sheet, drag down the row gutter to select a run of rows and choose Data ▸ Rows ▸ Color ▸ Orange. To pick the rows on a chart instead, shift-drag over the points to mark them, switch to the Data sheet card, choose Data ▸ Rows ▸ Select Marked Rows, then Color ▸ Orange — and Clear All Marks if the marks were only a means to an end.
Who wins, and using both
Each point resolves its color in one order: the chart's partition, then the row's own color, then Color by Column, then the series default. Markers follow the same order, except a partition claims the shape only when Symbols by Group is on. A partition's colors are a key, so nothing repaints them. That gives two clean ways to show groups and flagged rows together:
- Analysis by group, flags by shape. Keep Partition =
continent, select the countries you're watching, and give them Marker ▸ Star. The continent colors and fits stay; the stars stand out. - Colors only, flags by color. Clear the partition, use Color by Column… =
continentfor the base, and give a few rows Color ▸ Black. A row's own color beats the base.
One caveat: a hand-picked row color adds no legend entry — it's your encoding, not a mapping Stratum can explain, so name those points with labels if readers need to know. If one chart should ignore row styling, uncheck Use row colors & markers at the top of the Chart Inspector's Series tab.
The short version
| Partition | Row color / marker | |
|---|---|---|
| Belongs to | One chart | The row (whole dataset) |
| Changes computation | Yes — fits and correlations per group when you ask | No |
| Legend | Keyed per level | Color by Column is keyed; a row's own color is not |
| Shown on | That chart (and every gallery panel, same colors) | Every point chart, plus the data sheet gutter |
| Set from | The chart's control bar | Data ▸ Rows, a point's right-click menu, Color by Column… |
| Level colors | Both use Column Definition ▸ Colors & Markers | |
Frequently asked questions
How do I color points by group on a scatter plot?
Set the chart's Partition to the grouping column. Each level gets its color, the legend keys it, and the chart can then fit a line and compute a correlation per group. If you only want the colors and not the per-group analysis, use Data ▸ Rows ▸ Color by Column… instead.
What is the difference between a Partition and Color by Column?
A Partition belongs to one chart and defines groups that chart computes on — per-group fits, per-group correlations, a keyed legend. Color by Column is a dataset setting that only colors rows: every point chart in the file shows it, and nothing is computed per group. Both draw a level in the same color, set under Column Definition ▸ Colors & Markers.
Why doesn't my row color show on a partitioned chart?
A partition's colors are a key, so nothing repaints them: the partition wins the color channel. Give the rows a marker instead — it shows unless the chart's Symbols by Group is on — or use Color by Column in place of the partition.
Can I color a measurement as a gradient?
Yes. Color by Column… on a continuous column shades each row from the Lowest: color to the Highest: color you pick, and the chart's legend shows the range.
Do row colors appear on bar charts and histograms?
No. Row colors and markers are drawn on point-level marks — Scatter, Bubble, Trend points, Q-Q, Box-Whisker points, Dot/Strip, Parallel Plot, PCA Biplot, regression diagnostic plots and the control charts. Bars, boxes, bins and wedges keep their own colors.
Can I turn row colors off for one chart?
Yes. Uncheck Use row colors & markers at the top of the Chart Inspector's Series tab and that chart draws its plain series colors and shapes.
Related: How to Label Specific Points on a Scatter Plot → · Simpson's Paradox in the Wild →