Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Best practices · Data and ML

Data Visualization Best Practices

Opens with credits

Best practices for charts and data visualizations, checked against the UK Government Analysis Function's chart and colour guidance, WCAG 2.2, and the matplotlib, Plotly and Vega-Lite documentation. It covers choosing the chart, encoding and clutter, color and accessibility, axes and scales, titles and annotation, dashboards and interactive charts, and how to avoid charts that mislead.

Written by Tauseef Fayyaz7 chapters, 29 practicesAbout 18 min22 quiz questionsReviewed 13 October 2026

What you will learn

7 chapters · about 18 min

  1. 1Start from the question and choose the chartThe right chart follows from the message and the shape of the data. These practices pick a chart type before any styling happens.4 practices · 3 min
  2. 2Encoding and clutterEvery mark, color and line on a chart should carry information. These practices remove what does not and make what does easy to read.4 practices · 2 min
  3. Color and accessibilityColor is powerful and easy to misuse. These practices pick color by data type, meet WCAG contrast rules and make sure no one depends on color alone.5 practices · 4 minOpens with credits
  4. Axes and scalesAxes decide how big a difference looks. These practices keep the visual size of a change in proportion to the real one.4 practices · 3 minOpens with credits
  5. Titles, annotation and contextA chart without context leaves readers to guess what matters. These practices put the message, the explanation and the source on the chart.4 practices · 2 minOpens with credits
  6. Dashboards and interactive chartsDashboards put many charts in front of busy people. These practices keep them focused, fast and usable by everyone.4 practices · 2 minOpens with credits
  7. Avoiding misleading chartsA chart can be built from correct numbers and still leave a false impression. These practices catch the common ways that happens.4 practices · 2 minOpens with credits

About this guide

A chart has one job: to help someone understand something about the data faster than they could from a table. Most bad charts fail that job in ordinary ways. The message is buried under a legend with eight colors. The bars start at 40, so a 5% difference looks like a doubling. Two lines that matter are red and green, and one reader in your audience cannot tell them apart. The title says "Revenue by month" when what you wanted people to notice is that revenue fell after the price change. These data visualization best practices are about avoiding those failures.

The guide leans on the UK Government Analysis Function's chart guidance, written for analysts who publish official statistics, and on the Web Content Accessibility Guidelines (WCAG) 2.2, the standard that public sector charts in many countries must meet. Code examples use matplotlib, Plotly and Vega-Lite, because each publishes detailed documentation and between them they cover static charts, interactive charts and declarative specs. The principles apply equally to Excel, Tableau, Power BI or D3.

Work through the chapters in order the first time. The first chapter starts with the question, not the chart type, because a chart chosen before you know your message is usually the wrong chart. The middle chapters cover the details that decide whether people can read it: encoding, color, axes and annotation. The last two cover dashboards and the ways a technically correct chart can still mislead.

Two habits are worth taking from this guide even if you read nothing else. Write your chart's message as one sentence before you draw it, and never let color be the only way to tell two things apart.

Common questions

Should a chart's y-axis always start at zero?

Bar charts should, because a bar shows a value as its length and a truncated axis distorts every comparison. Line charts show values by position, so zooming in can be honest when small changes matter, but mark any axis break, keep a sensible aspect ratio and say so in the text.

What colors should I use in charts for color blind readers?

Never make color the only difference: add direct labels, markers or line styles. Avoid red versus green as the key contrast, use perceptually uniform colormaps such as viridis or cividis for continuous data, and check the chart in grayscale. WCAG asks for 3:1 contrast for chart graphics and 4.5:1 for normal text.

When should I use a pie chart?

Rarely. UK Government Analysis Function guidance limits pie charts to part-to-whole data with five categories or fewer, ideally with one dominant share, labelled directly. For more categories or similar values, a sorted bar chart is easier to read.

Why are dual-axis charts considered misleading?

With two y-axes the author can choose both scales freely, so any two lines can be made to cross or move together. Use two charts with a shared x-axis, index both series to 100 at a common start date, or plot one measure against the other in a scatter plot.

What makes a good chart title?

A headline that states the main message, such as "Tickets halved after the new help centre launched", followed by a subtitle with what was measured, where and when. Put the source and extraction date in a note under the chart.

How do I make an interactive chart accessible?

Keep the message and key values visible without hovering, make all controls usable by keyboard with visible focus, provide a text description of the takeaway, and offer the data as a table or download. Test with keyboard and screen readers, since interactive charts often fail there.

Sources (8)

Checked against these, last on 13 October 2026.

  1. Data visualisation: charts, UK Government Analysis Functionanalysisfunction.civilservice.gov.uk/policy-store/data-visualisation-charts/
  2. Data visualisation: colours in charts, UK Government Analysis Functionanalysisfunction.civilservice.gov.uk/policy-store/data-visualisation-colours-in-charts/
  3. Data visualisation: testing dashboards for design and accessibility, UK Government Analysis Functionanalysisfunction.civilservice.gov.uk/policy-store/data-visualisation-testing-dashboards-for-design-and-accessibility
  4. Understanding Success Criterion 1.4.1: Use of Color, W3C WAIwww.w3.org/WAI/WCAG22/Understanding/use-of-color.html
  5. Understanding Success Criterion 1.4.11: Non-text Contrast, W3C WAIwww.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html
  6. Choosing Colormaps in Matplotlib, matplotlib docsmatplotlib.org/stable/users/explain/colors/colormaps.html
  7. Scale, Vega-Lite docsvega.github.io/vega-lite/docs/scale.html
  8. Axes in Python, Plotly docsplotly.com/python/axes/

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com