Skip to Main Content
UNH Library home

Introduction to Excel and Spreadsheets

Creating Charts in Excel

Different charts in Excel require the data to be organized in different ways. Sometimes you will even want to summarize or filter the data before you create a visualization. PivotTables make this process much easier by allowing each chart to have its own special data table, while the original data stays safe in a different sheet.  You should be able to use PivotTables to arrange data for the various chart recipes below.

Excel charts can be built either by using the "Select Data Source" box to select data for different parts of the chart or by highlighting a group of cells and using the "Insert Chart" menu. The problem with the second method is that it's not always clear what arrangement of data will be appropriate for each chart.

Here is a list of data arrangements that should work well for the individual charts mentioned. These "recipes" should work reliably, but if you have any trouble, you can always fall back on "Select Data Source" box, which can help you build the chart one axis and one data series at a time.

Excel Chart Recipes

Pie Chart Recipe

Each row will become a separate slice, each with a separate color. Rows should be sorted by the numerical column, in descending order, so the slices will all be in size order.

Bar Chart Recipe

Each row will become a separate bar. Rows should be sorted by the numerical column, in descending order, so the bars will all be in size order.

Grouped Bar Chart Recipe

The same data structure should work for stacked bars and the other variations in Excel. If the groups and colors don’t look right the first time, look for the “Switch Row/Column” button.

Line Chart Recipe

Each row will become a separate line in the chart. If the x positions and colors don’t look right the first time, look for the “Switch Row/Column” button.

Scatter Plot Recipe

When you go to insert the chart, select just the numbers. If you select the first column (the row names), Excel will use them as the x axis values, converting each name to an integer. 

Note: starting with Excel 2013 for Windows, you can use Format Data Labels to add unique names for each dot.  First Add Data Labels, then Format Data Labels. Uncheck the default data label, then choose “Value From Cells”. Select the cells that contain the labels for the individual data points.

Scatter Plot with Color

This is where Excel gets a bit wacky. The first column should contain the x values for all data points, regardless of what color (or “series”) the point is in. Then, you will have two (or more) separate columns that contain y values for the separate series. 

In this example, each x value has only one y value, but that is not a requirement. If there are two y values in the same row, Excel will still make two dots, both using the same x value.

Remember: select just number columns, no text columns. 

Bubble Chart Recipe

Three columns of numbers can either be a scatterplot with two colors or a bubble chart. The only difference is the chart type you pick from the menu.

Selecting only four columns gives unreliable results. Excel might switch orientations and treat the columns as dots and the rows as the position variables. Excel might use a sequence of integers for the x axis values, use the odd-numbered columns for the y axis values, and use the even-numbered columns for the sizes. If there’s anything special you want to do, it’s probably best to build the chart one series at a time, manually selecting the values yourself.

Remember: select just number columns, no text columns.

Bubble Chart with Color

Selecting five columns of numbers before you insert a Bubble Chart will generate a bubble chart with two colors. Just like the scatter plot with color, the first column contains the x axis values for both series. Then Excel just cycles through groups of two columns, where the first column is the y axis position and the second column is the size. 

In this example, each x value has y and size values for only one series, but that is not a requirement. You can use the same x value for two dots, but you need to have both size and value specified for both dots.    

Remember: select just number columns, no text columns. 

Matching Data with Charts

 

Categorical variables

Encoded
as…

Numerical variables

Encoded
as…

Good for…

Pie chart

1

Color

1

Angle

Simple proportions

Line chart

0 or 1

Color

2 (including date)

Position

Trends over time

Bar chart

1 or 2

Position, color

1

Length

Broad audiences, precise comparisons

Scatter plot

0 or 1

Color

2

Position

Correlations

Bubble chart

0 or 1

Color

3

Position,  area

Extra variables

Heatmap

0, 1, or 2

Position

1, 2, or 3

Color, position

Comparing categorical variables

For more about data visualizations including strengths and weakness of chart types, see Zoss, Angela M. “Designing Public Visualizations of Library Data.” In Data Visualization: A Guide to Visual Storytelling for Librarians, edited by Lauren Magnuson. Lanham, MD: Rowman & Littlefield Publishers, Inc., forthcoming. doi:10.6084/m9.figshare.3811713

This LibGuide was adapted with permission from Duke Libraries Excel by Angela Zoss

Data Visualization: Best Practices

Choosing a Chart Type

Selection of graphs from the Data Visualization Catalogue

While some types of charts are more commonly used than others - such as bar charts, line charts, and scatterplots - there are many types of graphs available to choose from. Your choice of a particular chart type for your data visualization may be constrained by the type of data you are working with or the number of variables you want to graph, or you may want to choose your chart type based on what type of pattern you are trying to show (comparison, part-to-whole, hierarchy, etc.). Here are several interactive resources to help you decide on a chart and, in most cases, find a tool to create it.

Accessible Design

When designing a data visualization, the primary goal is to communicate information using visual means, and whether you share your visualizations in print or digital form, designing for accessibility is important. Although color is most frequently mentioned in this context, accessible design goes beyond avoiding color palettes that make charts difficult to read by individuals with color vision deficiencies like red-green colorblindness, or protanopia. There are many ways to make your graphs easier to understand for people with visual impairments or other disabilities, and designing for accessibility can make your data visualizations more readable for all users.

The following articles offer good overviews of the issues involved in designing for accessibility.

Read more about the Web Accessibility Initiative at w3.org.


Color & Contrast

The following tools can help you get started with choosing accessible color palettes and contrast ratios in your visualization.


General Best Practices

In addition to color, there are other aspects of visualizations to consider when designing for accessibility. For example:

  • Image "alt" tags:
    Always add descriptive text in an "alt tag" when embedding your visualizations in a webpage. Screen readers read alt text out loud for users with visual impairment, so it is important to include a concise but accurate description of a graph.
  • Font and descriptive labels:
    Use a sans-serif font for chart titles and descriptive labels, and consider labeling data directly whenever possible rather than putting values or other information only in a chart legend.
Data Visualization: Best Practices was created by UB Libraries' 2018-2020 CLIR Postdoctoral Fellow, Rachel Starry. It is currently maintained by Carolyn Klotzbach-Russell. Guide content is licensed CC BY 4.0.