跳到正文

第 10 课 · Tables and Charts

Choosing Charts for Reports

Pick a chart by the question it answers: trend, comparison, share, distribution or relationship, then label it honestly and give it a title that states the point.

In a report, a chart has a narrow job: to let a busy reader see one pattern correctly and quickly. You do not need many chart types for that. A few well-chosen, honestly drawn charts cover most reporting needs. This lesson focuses on choices that matter in reports. For a broader tour of chart types and how to build them in code, see choosing the right chart.

Start from the question

Question Usual choice
How has it changed over time? Line chart
Which categories are larger? Bar chart, sorted
How is a whole divided? Stacked bar, or pie with very few parts
How are values spread? Histogram or box plot
Do two measures move together? Scatter plot
How far are we from a target? Bar with target mark, or a line with a target line

If you cannot name the question, do not add the chart.

Reporting favorites

Four charts cover much of reporting

Line Trend over time
Bar Compare categories
Bar with target Actual against plan
Small multiples Same chart per group
1 / 2

Small multiples are several small charts of the same kind, one for each region or product, with shared scales. They are often clearer than one chart with eight crossing lines.

Honest axes

  • Bars start at zero. Readers compare bar lengths, so cutting the axis exaggerates differences.
  • Lines may use a narrower range, because readers compare positions and slopes. Label the axis clearly, and think about whether the zoom makes a tiny change look dramatic.
  • Time goes left to right with even spacing. Show gaps in dates as gaps.
  • Do not hide a partial period. A current month with only a few days of data looks like a collapse. Mark it, leave it out or compare equal day ranges.

The next example shows how a truncated bar axis changes the visual impression. It draws simple text bars with two different starting points.

Python The same values with two axis starts

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 real difference is about 5%. In the second drawing, the East bar is six times as long as the North bar.

Titles and labels do the explaining

A descriptive title names the content: "Late deliveries by warehouse". A message title states the point: "Pune is furthest above the late-delivery target". Message titles help readers, but they must stay true after each refresh. In an automated report, either generate the sentence from the data with careful rules or use a descriptive title.

A good report chart also has:

  • Axis labels or a title that gives the unit.
  • The period and population, such as "online orders, Nov 2026".
  • Direct labels near lines or bars when there is room, so readers need no legend lookup.
  • A source and a "data through" date.

Use color with purpose

Use one neutral color for context and one strong color for the item you want noticed. Keep the same color for the same category on every page. Check contrast, and add labels or patterns so that meaning does not depend on color. The color and accessibility lesson explains this fully. For people who cannot see the chart, write a short text alternative that states the main pattern and key values, and offer the data as a table.

A text alternative from data

Python Generate a plain-text chart summary

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 summary states facts only. It does not say why orders moved, because the series alone cannot show that.

Charts are often printed, projected or viewed on phones. Test each one at its real size. Labels that look fine on a large monitor may become unreadable. If a chart needs zooming to be read, simplify it or replace it with a short table.

How much history to show

The time range changes what a reader can see. A chart with only two periods shows a difference but no context. A chart with three years of daily values shows context but may hide last week in a thick line.

Choose the range from the question. To judge whether this week is unusual, show enough earlier weeks to reveal normal variation. If your business has seasons, include at least the same season a year earlier when you have it. For very noisy daily data, show weekly totals, or draw a rolling average over faint daily points and label both. Remember that a rolling average reacts late, so a sudden break appears gently at first.

Keep the range, scale and chart type stable between issues. Readers of a recurring report learn its shapes. When an axis rescales automatically each week, the same value can appear high in one issue and low in the next. If you must change the scale because the data has outgrown it, add a short note.

Annotate known events, such as a price change, an outage or a new definition, directly on the time line. State the event as a fact about timing. A note next to a bend in a line does not show that the event caused it.

Be careful with dual-axis charts. By changing one scale, you can make two lines appear to match or to diverge. Two separate charts placed one above the other are usually safer.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. Why should bar charts start at zero?

    Length encodes the value. Removing the baseline breaks that relationship.
  2. 2. Which chart fits eight regions' trends if one line chart becomes tangled?

    One small chart per region keeps each trend readable and comparable.
  3. 3. What is the risk of showing the current month after only three days?

    A partial period is not comparable with full months unless it is marked.

Summary

  • Choose a chart from the question: trend, comparison, share, spread or relationship.
  • Start bars at zero, space time evenly and mark partial periods.
  • State units, period, source and data date, and use message titles only when they stay true.
  • Use color sparingly and consistently, with labels and a text alternative.
  • Test charts at the size and medium where they will be read.

Next: Formatting Numbers, Dates and Labels

你的学习进度保存在此浏览器中,无需账号。