Data Visualization Best Practices

Chapter 2 · Practice 4 of 4

Format numbers and units so they read without effort

From Encoding and clutter

Why it matters

Small formatting choices decide whether a chart is read or squinted at. The Analysis Function recommends right-aligning y-axis values, using thousands separators, sans serif fonts and labelling all axes and series.

  • Put units in the axis title or tick labels: "Revenue (USD millions)", "ms", "%".
  • Round to the precision that matters; 12.4% is easier than 12.3871%.
  • Use consistent formats across charts in the same report.

Each library has a formatter:

LibraryThousands separator
matplotlibax.yaxis.set_major_formatter(StrMethodFormatter("{x:,.0f}"))
Plotlyfig.update_yaxes(tickformat=",")
Vega-Lite"axis": {"format": ","}