Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 2.5 — Honest and Misleading Charts
Data Visualization · Example 1 of 3

Measure the lie: cut bars, trimmed lines, rainbow

A and C use the same numbers: a cut axis on bars lies, a trimmed axis on a labelled line does not. In D, the rainbow strip's neighbouring months look unrelated, while the one-hue strip reads as an ordered scale.

A chart can be built from correct numbers and still mislead: a cut axis on bars, two y axes, circles sized by radius, a hand-picked time window, totals instead of rates, uneven bins, a rainbow colour scale. Learn to spot each one, measure how much it lies, and fix it.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 4 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write lieFactor(shownA, shownB, trueA, trueB) that returns (shown effect ÷ true effect), using effect = (B − A) ÷ A. Return NaN when the true effect is zero. Check it with the June and July example: shown lengths 7,712 and 17,803, true 107,712 and 117,803.

02

A chart shows 12 months of rides with the y axis starting at 40,000. Is that honest for bars? For a line?

Explain it without notes

01

Why must a bar chart start at zero but a line chart need not?

02

What is a lie factor? Compute it for June and July with the axis cut at 100,000.

03

Why can a dual-axis chart mislead even if both axes are labelled?

04

What is wrong with a histogram whose bins have different widths and whose bar height is the count?

Measure the lie: cut bars, trimmed lines, rainbow

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

cut bars show July 2.31x June; data: 1.09x; lie factor 14.0
zero-based bars lie factor: 1.0
total of the 12 months: 933651