Color is the most misused element in data visualization. Used well, it is a data channel that encodes magnitude or groups and directs the reader's attention exactly where you want it. Used carelessly — a different bright color for every bar, a rainbow gradient on a map — it adds noise, implies meaning that is not there, and locks out the millions of readers with color vision deficiency. The good news is that most color decisions reduce to one question: what kind of data am I coloring.
For an analyst, disciplined color use is what makes a chart look professional and, more importantly, read correctly. It is worth treating color as seriously as the numbers.
Match the palette to the data
There are three palette families, and choosing the right one is the whole game.
- Sequential — a single hue from light to dark, for ordered data that runs low to high with no natural midpoint: population, sales, counts. Darker means more. This is the default for magnitude.
- Diverging — two contrasting hues meeting at a neutral middle, for data centered on a meaningful midpoint: correlation (around zero), percent change, profit versus loss. One hue for below the midpoint, the other for above.
- Categorical (qualitative) — distinct, unordered hues for separate groups: product lines, regions, plan tiers. The hues should be equally distinct and carry no implied order.
Sequential (low -> high): [pale] [light] [mid] [dark] [darkest]
Diverging (neg <- 0 -> pos): [blue] [pale-blue] [white] [pale-red] [red]
Categorical (no order): [blue] [orange] [green] [purple] (distinct)
The classic error is using a categorical palette for ordered data (readers can't tell which group is "more") or a sequential palette for categories (implying an order that doesn't exist). Match the family to the data first, then pick specific colors.
Use perceptually uniform, colorblind-safe scales
For continuous color — heatmaps, filled maps — prefer a perceptually uniform scale like viridis, where equal steps in value look like equal steps in color. Avoid the old rainbow (jet) scale: it has no perceptual order, invents false boundaries where the hue changes sharply, and is unreadable for colorblind viewers.
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
# Illustrative sample: a 5x5 grid of intensity values
grid = np.array([
[1, 2, 2, 3, 4],
[2, 3, 4, 4, 5],
[2, 4, 5, 6, 6],
[3, 4, 6, 7, 8],
[4, 5, 6, 8, 9],
])
fig, axes = plt.subplots(1, 2, figsize=(11, 4))
sns.heatmap(grid, cmap="viridis", ax=axes[0], cbar=True)
axes[0].set_title("viridis: ordered and colorblind-safe", loc="left")
sns.heatmap(grid, cmap="jet", ax=axes[1], cbar=True)
axes[1].set_title("jet (rainbow): avoid", loc="left")
plt.tight_layout()
plt.show()
What this renders: the same grid twice. With viridis (left), color
moves smoothly from dark purple (low) through green to yellow (high),
so higher values read as clearly brighter and the order is obvious.
With jet (right), the grid jumps blue-green-yellow-red with hard visual
edges that suggest boundaries the data does not have, and the ordering
of colors is not intuitive. The contrast shows why viridis is preferred.
Because roughly one in twelve men has a red-green color deficiency, never rely on red-versus-green alone to distinguish categories, and always add a second cue — a label, a shape, or position — so color is not the only signal.
Color as a spotlight
The most effective use of color is restraint. Draw everything in neutral gray and reserve one strong color for the single element you want the reader to notice. This is the technique in the data visualization principles: one highlighted bar or line among muted ones directs attention instantly, survives grayscale printing, and looks far more polished than a chart where every element competes for attention with its own bright color.
Practical usage
Analysts standardize a small palette across a dashboard so the same category is the same color everywhere, which lets readers learn the code once. They pick sequential scales for magnitude maps and heatmaps, diverging scales for anything measuring change from a baseline, and reserve saturated colors for highlights while keeping context in gray. When a chart has many categories, the professional move is not more colors but fewer — grouping small categories, labeling directly, or highlighting only what matters. Color choices in heatmaps are an especially high-stakes version of these rules.
Common mistakes
- Rainbow scales for magnitude. No perceptual order and colorblind-unsafe. Use viridis or a single-hue sequential scale.
- Wrong palette family. Categorical colors for ordered data, or sequential for unordered groups, misleads about structure.
- Red-green as the only distinction. Excludes colorblind readers. Add labels or shapes and choose safe hues.
- Too many colors. More than about eight categories overwhelms the eye and the legend. Group or highlight instead.
- Color with no meaning. Coloring every bar differently when the categories are already labeled adds noise and implies significance that is not there.
In interviews
Color questions appear as "how would you make this chart accessible" or "why is this heatmap hard to read." Strong answers name the three palette families and match them to data types, call out the rainbow scale and red-green problem, and mention adding a non-color cue for accessibility. Saying "I'd gray out the context and highlight the one series in question" shows you understand color as attention control, not decoration.
Where this fits in your learning path
Color decisions cut across every chart, so this topic reinforces the data visualization principles and is essential for reading heatmaps in data analysis correctly. Misused color is also a common tactic in misleading charts. Handling color well is a professional-polish skill on the data analyst roadmap and throughout the data analytics hub.
Frequently Asked Questions
What are the three main types of color palettes?
Why should I avoid the rainbow color scale?
How do I make charts colorblind-friendly?
How many colors should a categorical chart use?
How should I use color to highlight?
Want to Build Your Career in Data Analytics with AI?
Join CodeBegun and train with working industry engineers — Check the Data Analyst training details

