Tech News, Tech & Coding · Free Online Tools

IT Question Answer
Tools
Back to How To Guides

How to Choose the Right Chart for Your Data

How To GuidesData ScienceBy Muhammad Fareed
data-visualizationchartsdata-sciencedashboards

Short answer: start with the question you want to answer. Use bar charts to compare categories, line charts to show change over time, histograms for distributions, scatter plots for relationships and, sparingly, pie or stacked charts for parts of a whole.

Match the chart to the question

QuestionGood choice
How do categories compare?Bar or column chart
How does a value change over time?Line chart
How are values distributed?Histogram or box plot
Are two variables related?Scatter plot
What are the parts of a whole?Stacked bar, or a pie chart with few slices
How do values rank?Sorted horizontal bar chart
What is the pattern across two categories?Heatmap

Charts to use with care

  • Pie charts: hard to compare slices that are close in size. Use them for two to five parts, or switch to a bar chart.
  • 3D charts: distort proportions and add no information.
  • Dual-axis charts: can imply relationships that are not there.
  • Truncated axes: a bar chart that does not start at zero exaggerates differences.

Design principles

  1. One message per chart, stated in the title, such as "Sales grew in every region in Q3".
  2. Label directly instead of relying on a distant legend when possible.
  3. Use color for meaning, such as highlighting one bar, and keep the rest neutral.
  4. Remove clutter: heavy gridlines, borders and decoration.
  5. Sort sensibly: by value, unless categories have a natural order.
  6. Make it accessible: use color-blind-safe palettes and sufficient contrast.

Example

Suppose you have monthly website visitors for two years. A line chart shows the trend and seasonality. If you want to compare average visitors by country, use a sorted bar chart. If you want to see whether more visitors relate to more sales, use a scatter plot of visitors against sales, one point per month.

Tools

Spreadsheets, Power BI, Tableau and Looker Studio are common for dashboards. In Python, Matplotlib, Seaborn and Plotly are popular, and in JavaScript, libraries such as D3 and Chart.js give interactive charts.

Before and after: improving a chart

A cluttered chart often has a 3D effect, a rainbow of colors, a legend far from the data and a vague title such as "Sales". Improve it by switching to a flat bar chart, coloring only the bar you want people to notice, labeling bars directly and writing a title that states the finding, such as "North region sales grew 12% in Q3". The same data becomes clear in seconds.

Frequently asked questions

When is a pie chart acceptable?

When you show a few parts of a whole and the differences between slices are large, for example 60%, 30% and 10%. For many slices or similar values, use a bar chart.

Should every chart start at zero?

Bar charts should, because bar length represents value. Line charts can use a different baseline if it is clearly labeled and does not mislead.

How many colors should a chart have?

As few as possible. Use one accent color to draw attention and neutral tones for the rest, and limit categorical colors to about five or six.