Graphing Charts in Microsoft Excel
Graphing Charts in Microsoft Excel
Theresa A Scott, MS
Biostatistician II
Department of Biostatistics
Vanderbilt University
[email protected]
Table of Contents
1 Introduction 1
1.1 Is a Chart Really Necessary? . . . . . . . . . . . . . . . . . . . . 2
i
Preface
All of the lecture notes and supplementary sample data files are located at
http://biostat.mc.vanderbilt.edu/TheresaScott under Current Teaching
Material.
Books:
1
2
The online tutorials and CDs are divided into several categories including Busi-
ness Applications, Databases, Graphics & Page Layout, Operating Systems, and
Programming.
Adobe Acrobat 7.
Section 1
Introduction
In addition to everything we’ve learned so far, Excel also allows you to present
your data visually, in the form of a chart (also know as a graph).
Displaying data in a well-conceived chart can make your data more understand-
able.
Useful for summarizing a series of numbers and their interrelationships.
Often helps you spot trends and patterns that might otherwise go unno-
ticed.
Another advantage is that, just like formulas and functions, charts are dynamic.
A chart is linked to the data in your worksheet.
Before you can create a chart, you must have some data.
Stored in the cells of a worksheet.
Can be stored in any number of worksheets, and the worksheets can even
be in different workbooks.
1
SECTION 1. INTRODUCTION 2
EXAMPLE: A line chart that uses two data series – see the Example Chart
– Line 2 Series worksheet of the ExampleCharts.AND.PracticeExercises.xls
workbook.
– Chart contains two lines, each representing one data series.
– Each point on the line is determined by the value in a single cell, and
is represented by a marker.
– Can distinguish each of the lines by its thickness, line style, color, or
data markers.
Be aware: Although Excel can produce some great charts, it certainly doesn’t
generate the best-looking charts possible.
You’ll eventually encounter some limitations with Excel’s charting fea-
tures.
Other software products can generate higher-quality charts and provide a
great deal more flexibility.
Before you assume that a chart is required, consider the alternatives and then
make a decision.
For simple data, a nicely formatted table may be a better option.
The most common – and the most flexible – way to create a chart is to use the
Chart Wizard.
The Chart Wizard consists of four sequential dialog boxes that prompt you for
various settings of the chart. By the time you reach the last dialog box, the
chart is usually fairly close to what is needed.
While using the Chart Wizard, you can go back to the preceding step by clicking
the Back button. Or, you can click Finish to close the Chart Wizard.
If you close the Chart Wizard early, Excel creates the chart using the in-
formation that you provided up to that point.
3
SECTION 2. CREATING A CHART USING THE CHART WIZARD 4
IMPORTANT: Don’t be too concerned about creating the perfect chart. You
can always change, at any time, any choice that you made in the Chart Wizard
after the chart is created.
NOTE: The data that you use in a chart does not have to be contiguous (i.e.
adjacent).1
Use the Ctrl key to make multiple selections.
If you need to plot data that exists on more than one worksheet, you can
add more series after the chart is created (or use the Series tab in Step 2
– Chart Source Data).
– In all cases, however, the data for a single chart series must reside on
one sheet.
After you select the data, start the Chart Wizard, either by clicking the Chart
Wizard button icon on the Standard toolbar or by selecting Chart from the Insert
drop-menu.
The chart types are organized into two tabs: Standard Types and Custom
Types.
The Standard Types tab displays the 14 basic chart types and the subtypes
for each.
– Select the chart type from the Chart type list box and then click the
appropriate icon for the subtype from the Chart sub-type icon box.
– A brief description of the chart sub-type is given when the sub-type
is chosen.
– Click the Press and Hold to View Sample button and keep the mouse
button pressed to preview your data with the selected chart type and
sub-type.
The Custom Types tab displays some customized charts (including user-
defined custom charts).
– Select the chart type from the Chart type list box.
– The dialog box automatically shows a preview of your data with the
selected chart type in the Sample: box.
When you decide on a chart type and subtype, click the Next button to move
to the next step.
Radar.
– Has a separate axis for each category, and the axes extend outward
from the center of the chart.
– The value of each data point is plotted on the corresponding axis.
Surface.
– Essentially the same, except for the shapes that are used.
SECTION 2. CREATING A CHART USING THE CHART WIZARD 8
Combines two different chart types, such as a column chart and a line
chart.
Each series is assigned to its own chart type.
Requires that the chart types use the same category axis, but they may
have different value axes.
3-D charts cannot be combined with another chart type.
The following table lists the custom chart types, including a brief description of
how each type has been customized:
B&W Area An area chart that uses black and white patterns
rather than color.
B&W Line – Timescale An area chart that uses black and white gradient
fill rather than color.
B&W Pie A pie chart that uses black and white patterns
rather than color.
Blue Pie A pie chart with all slices exploded, data labels,
and a gradient background.
Colored Lines A line chart with brightly colored lines and grid-
lines on a black background.
Floating Bars A bar chart in which one series has been made
invisible.
Outdoor Bars A bar chart with fill patterns that resemble wood,
with a green background.
Pie Explosion A 3-D pie chart with all slices exploded, on a dark
background.
4. Test and refine – test the custom chart type with a different data series.
If the chart doesn’t look right you may need to make some additional
changes to it.
After doing so, you will need to go through the previous steps to add
the chart to the custom gallery.
If you use the same name, Excel will ask whether you want to replace
the existing user-defined format – answer in the affirmative.
In almost every case, the underlying message in a chart is some type of compar-
ison. Examples of some general types of comparisons include:
Comparison Example
Compare item to other Compare sales in each of a company’s sales re-
items. gions.
Compare data over time. Display sales by month and indicate trends over
time.
Comparison Example
Frequency comparison. Display the number (or percentage) of students
who scored within a particular range.
Identify ’outliers’ or un- Creating a chart may help identify data that is not
usual situations. representative, especially if you have large number
of data points.
Choosing the correct chart type is a key factor in making the message com-
pelling.
Well worth your time to experiment with various chart types to determine
which is most effective.
So, how do you know which chart type to use for your data?
No cut-and-dried answer to this question.
Perhaps the best answer is a vague one: Use the chart type that gets your
message across in the simplest way.
Fortunately, changing a chart’s type is a very easy procedure, so you can exper-
iment with various chart types until you find the one that represents your data
accurately and clearly – and as simply as possible.
Generally speaking, a 3-D chart is best used when the goal is to show general
trends rather than precise comparisons.
SECTION 2. CREATING A CHART USING THE CHART WIZARD 12
As mentioned, you can select the data prior to starting the Chart Wizard or
you can select the data for the first time during this step.
Once you’ve specified the correct data to be used, click the Next button to
advance to the next dialog box.
If the data range is not correct, you can change it by deleting the address
given in the Data range field and then selecting the correct range by clicking-
and-dragging in the worksheet.
Specifying the source data using the Data Range tab is easiest when the data is
formatted in a similar fashion to the following table:
When specifying the range address in the Data Range field, you want to in-
clude items such as labels and series identifiers (row and column headings; i.e.,
Eastern TN).
The Data Range tab also allows you to specify the orientation of the data – is
the data for each series in a single row or a single column.
SECTION 2. CREATING A CHART USING THE CHART WIZARD 13
Click the Rows or Columns option button next to Series in to specify the
orientation of your data is by rows, or by columns, respectively.
By default Excel always defaults to a chart that has more categories than
series.
– If the data rows outnumber the data columns, then each series is
assumed to occupy a column.
– If the data columns outnumber the data rows, then each series is
assumed to occupy a row.
Your choice of orientation will determine how many series the chart has, and it
will affect the appearance and (possibly) the legibility of your chart.
→ Practice Exercise: Using the Personal Budget data in the Practice Exercise 1
– Range worksheet of the ExampleCharts.AND.PracticeExercises.xls workbook:
1. Select the individual cost data across all six months – the cell range
A5:G11.
2. Start the Chart Wizard.
3. Choose a Column chart in Step 1 – Chart Type.
4. In the Data Range tab of Step 2 – Chart Source Data, preview the column
chart in both orientations – by rows and by columns.
Select Rows and then Columns for the Series in option.
2.3.2 Series
The Series tab allows you to specify each series of data explicitly.
Remove any incorrect series by selecting them in the Series list box and
clicking Remove.
Add any necessary series by specifying a cell address or text for the series
name in the Name field, selecting the range address in the Values field, and
then clicking Add.
Add a category axis label by specifying a cell address or text in the Cate-
gory (X) axis labels field.
Using the Series tab often gives you more freedom when specifying the source
data to be used in the chart.
Useful when the data is formatted in a similar fashion to the following table:
SECTION 2. CREATING A CHART USING THE CHART WIZARD 14
→ Practice Exercise: Using the Heart Rate data in the Practice Exercise 2 –
Series worksheet of the ExampleCharts.AND.PracticeExercises.xls workbook:
1. Do not select any cell range before starting the Chart Wizard.
2. Choose a XY (Scatter) chart in Step 1 – Chart Type of the Chart Wizard.
3. In the Series tab of Step 2 – Chart Source Data, add a series for each
treatment (tx; drug and placebo) specifying the baseline heart rate (basehr)
for the X values and heart rate at 30 minutes (hr30) for the Y values.
For the drug series, type Drug in the Name field, select the range
F4:F12 for the X values, select the range G4:12 for the Y values, and
click Add.
For the placebo series, type Placebo in the Name field, select the range
F13:F21 for the X values, select the range G13:21 for the Y values, and
click Add.
NOTE: The options available in Step 3 – Chart Options of the Chart Wizard
depend on the type of chart that you selected in Step 1 – Chart Type.
When you make changes, the changes are reflected in the preview chart.
After you select the chart options, click Next to move to the final dialog box.
Once you select the location and click Finish, Excel creates and displays the
chart.
Section 3
Modifying an Existing
Chart
Before you can customize an existing chart, you must activate it.
To activate a chart on a chart sheet, click its sheet tab.
To activate an embedded chart, click anywhere within the chart.
– Doing so not only activates the chart, but also selects the chart ele-
ment that you clicked.
– To deactivate an embedded chart, just click anywhere in the work-
sheet outside of the embedded chart.
TIP: In some cases, you may prefer to work with an embedded chart in a
separate window.
EXAMPLE: If the embedded chart is larger than the workbook window.
To display an embedded chart in a window, right-click the chart’s
Chart Area (the area near the border) and select Chart Window from the
shortcut menu.
– Creates a temporary floating window, which can be moved and re-
sized.
– To close this temporary window, click the ’X’ in the chart window’s
title bar (or just click anywhere in the worksheet).
16
SECTION 3. MODIFYING AN EXISTING CHART 17
The toolbar includes nine tools (from left to right), which you can use to make
common chart changes:
Chart Objects:
– When clicked, displays the Format dialog box for the selected chart
element, which can be used to make various formatting modifications.
Chart Type:
– Toggles (i.e., shows or hides) the legend display in the active chart.
Data Table:
– Toggles (i.e., shows or hides) the display of the data table in the
active chart.
By Row:
In addition, several tools on the other toolbars work with charts, including
the Fill Color, Font Color, Bold, Italic, and Font tools.
Excel includes several other chart-related tools that aren’t on the Chart toolbar.
You can customize the toolbar to include these additional tools. To customize
your Chart toolbar:
1. Make sure the Chart toolbar is displayed.
2. Choose Customize from Toolbars from the View drop-menu to display the
Customize dialog box.
3. Select the Commands tab.
4. Choose Charting from the Categories list box.
5. Click an item in the Commands list and drag it to your Chart toolbar.
6. Repeat Step 5 for other commands that you’d like to add.
Right-click the chart and choose Chart Type from the shortcut menu.
After selecting the new chart type, the selected chart will be changed to the
type you selected.
NOTE: If you’ve customized some aspects of your chart, choosing a new chart
type from the Custom Types tab may override some or all of the changes you’ve
made.
EXAMPLE: If you’ve added gridlines to the chart and then select a custom
chart type that doesn’t use gridlines, your gridlines disappear.
Good idea to make sure that you’re satisfied with the chart before you
make too many custom changes to it.
SECTION 3. MODIFYING AN EXISTING CHART 19
→ Practice Exercise: Using the Median House Prices data in the Example Chart
– Line 2 Series worksheet of the ExampleCharts.AND.PracticeExercises.xls work-
book:
Change the chart type from a Line chart to a Column chart using any of
the mentioned methods.
Because of time and space, only a few subsections are given regarding changing
the chart source data. Chapter 3: Working with Chart Series of Excel
Charts by John Walkenbach contains details of many more chart series tasks,
including:
charting a noncontiguous range;
using series on different sheets;
controlling a data series by hiding data;
AND using combination charts – creating combination charts and working
with multiple axes.
Open the Format Data Series dialog box from the Format drop-menu or by
clicking the Format Selected Object button on the Chart toolbar.
In the the Format Data Series dialog box, select a series in the list box.
Use the Move Up and Move Down buttons to adjust the position of the
selected series.
NOTE: It’s important to understand that these settings are applicable only
for the line charts, XY charts, and radar charts. For all other chart types, miss-
ing data is simply not plotted.
→ Practice Exercise: Using the Median House Prices data in the Example Chart
– Line 2 Series worksheet of the ExampleCharts.AND.PracticeExercises.xls work-
book:
Change the chart type back to a Line chart.
Apply all three methods of handling missing data separately, and deter-
mine the difference in the resulting charts.
SECTION 3. MODIFYING AN EXISTING CHART 21
– Some chart elements (such as a chart series, a legend, and data labels)
consist of multiple items – to select a particular data point, you need
to click twice.
– May find that some chart elements are difficult to select with the
mouse – may take several clicks before the desired element is actually
selected.
Selecting the chart element with the Chart toolbar.
– As mentioned, the Chart Object drop-down list box on the Chart tool-
bar lets you select a particular element from the active chart.
– Only lists the ’top level’ elements in the chart.
* EXAMPLE: To select an individual data point within a series,
select the series from the drop-down list box and then use the
mouse to select the desired data point.
Once a chart element is selected, you can access the element’s Format dialog
box to format or set options for that element in one of several ways:
Select the Selected Element Name command from the Format menu – the
Format menu displays the actual name of the selected part (i.e., if the
value axis is selected, the command is Selected Axis).
Select the chart element and use the Ctrl+1 keyboard shortcut.
SECTION 3. MODIFYING AN EXISTING CHART 22
Right-click the chart element and choose Format from the shortcut menu.
Some of the elements within a chart can be moved. The movable chart ele-
ments include the titles, the legend, and the data labels. To move a chart
element, simply click it to select it; then drag it to the desired location in the
chart. To delete a chart element, select it and then press the Delete key.
This operation also works in the opposite direction: You can select and em-
bedded chart and relocate it to a new chart sheet.
XY chart variations;
To resize a chart in a chart sheet: You can also size the chart in a chart
sheet according to the window size by using the Sized with Window command
from the View drop-menu.
When enabled, the chart adjusts itself when you resize the workbook win-
dow (it always fits perfectly in the window).
In this mode, the chart that you’re working on may or may not correspond
to how it looks when printed.
To delete an embedded chart, press the Ctrl key and click the chart (this
selects the chart as an object). Then press the Delete key. To delete a chart
sheet, right-click its sheet tab and choose Delete from the shortcut menu.
SECTION 3. MODIFYING AN EXISTING CHART 24
You cannot add a trendline to any type of 3-D chart, stacked chart, radar
chart, pie chart, or doughnut chart.
If you add a trendline and then change the chart type, or data series to a non-
supported type, the trendline is deleted.
The type of data used in a chart determines whether the chart is appropriate
for a trendline. Generally, charts that are suited for a trendline fall into two
categories:
Paired numeric data, as is typically plotted in an XY chart – both axes
are value axes.
Time-based data, often plotted in XY charts, line charts, column charts,
and area charts.
– Trendlines assume that the category axis contains equal-interval val-
ues (i.e., a time-based category axis) – there should be no gaps in the
data, and the data should be appropriate.
4. In the Options tab in the Add Trendline dialog box, specify other options if
necessary – the available options depend on the type of trendline chosen.
Trendline name: If you choose Custom, you can provide a different
caption for the trendline. This is the text that appears in the leg-
end. If you do not specify a custom name, the legend consists of the
trendline type, followed by the series name in parentheses.
Forecast: These options enable you to extend the trendline in either
forward, backward, or in both directions. You specify the number of
periods to forecast.
Set intercept: Enables you to specify the point on the value axis where
the trendline crosses the axis.
Display equation on chart: If checked, the regression equation for the
trendline will be displayed on the chart.
Display R-squared value on chart: If checked, the R-squared value for
the trendline will be displayed on the chart.
NOTE: A single series can have more than one trendline associated with it.
EXAMPLE: Add two different trendlines to determine which type better
fits the data.
Once a trendline has been added to a chart, you can select the trendline and
format it just as you can format any other element of the chart. You can also
format the trendline’s ’data label’, which may contain either the trendline equa-
tion, or the R-squared value, or both in a similar fashion.
See Chapter 5: Working with Trendlines and Error Bars of Excel Charts
by John Walkenbach for more details regarding trendlines, including:
linear trendlines;
nonlinear trendlines – logarithmic, power, exponential, and polynomial;
AND displaying a moving average.
Chapter 5 also discusses other series enhancements: series lines, drop lines,
high-low lines, up/down bars, and varied colors for data points.
Error bars are availabe for chart series of the following 2-D chart types:
SECTION 3. MODIFYING AN EXISTING CHART 26
Because XY charts and bubble charts each have two value axes, you can display
error bars for the x values, the y values, or both.
→ Practice Exercise: Using the Median House Prices data in the Example Chart
– Line 2 Series worksheet of the ExampleCharts.AND.PracticeExercises.xls work-
book:
1. Using the AVERAGE and STDEV functions, calculate the average and stan-
dard deviation of the median house prices in the Western States and the
United States from 1991 to 2001.
SECTION 3. MODIFYING AN EXISTING CHART 27
2. Create a column chart of the average median house price in the Western
States and the United States.
Define Western States and United States as two separate data series.
Create the chart as its own chart sheet.
3. Add a custom error bar to each column (i.e., series) that displays the
average plus or minus the standard deviation of each series.
Can change the line style and adjust the marker style (either on or off).
Contains a Y Error Bars tab, and possibly an X Error Bars tab, that enables
you to change the options you set when you created the error bars.
See Chapter 5: Working with Trendlines and Error Bars of Excel Charts
by John Walkenbach for more details regarding error bars, including:
using custom error bars;
Recall, Chapter 5 also discusses other series enhancements: series lines, drop
lines, high-low lines, up/down bars, and varied colors for data points.
Section 4
28
SECTION 4. OTHER CHART TASKS OF INTEREST 29
– Use the Chart tab in the Page Setup dialog box to specify several
options:
* Select Page Setup from the File drop-menu – for a chart sheet,
the Sheet tab is replaced with a tab named Chart.
* Use full page: Excel prints the chart to the full width and height
of the page margins. This usually isn’t a good choice because the
charts relative proportions change and you lose the WYSIWYG
advantage.
* Scale to fit page: Expands the chart proportionally in both di-
mensions until one dimension fills the space between the margins.
In other words, the aspect ratio of the chart is maintained. This
option usually results in the best printout.
* Custom: Prints the chart as it appears on your screen. Select
Sized with Window from the View drop-menu to make the chart
correspond to the window size and proportions. The chart prints
at the current window size and proportions.
The easiest way to share data among multiple applications is to use the basic
copy and paste technique:
1. Select something – a cell, range, some text, a picture, or a chart, for
example.
2. Choose Copy from the Edit drop-menu (or use the Ctrl+C keyboard short-
cut).
3. Activate something else, such as a different location in the current doc-
ument or a location in a different document (which could also be in a
different application).
4. Choose Paste from the Edit drop-menu (or use the Ctrl+V keyboard short-
cut).
Be aware: When you copy and paste an Excel chart into a PowerPoint slide
using the basic copy and paste technique, a copy of your entire Excel workbook
is automatically embedded in the PowerPoint presentation.
Therefore, if the chart you’re copying happens to be contained in a 10-
megabyte workbook file, all 10 of those megabytes come along for the
ride.
SECTION 4. OTHER CHART TASKS OF INTEREST 30
– Even worse, if you copy and paste another chart from the same work-
book into your presentation, another copy of the entire workbook is
embedded!
NOTE: The embedded workbook is not linked to the original Excel work-
book – if you modify the chart in the original workbook, those changes
will not be reflected in the PowerPoint slide.
– Double-click the Excel object in the PowerPoint slide to work with
the Excel embedded object using all of Excel’s commands.
For optimal control over your pasted chart, choose the destination application’s
Paste Special command from the Edit drop-menu (if it has one). This will display
a list of all available paste formats, and you can choose the most appropriate
one.
The Paste options:
– Microsoft Excel Chart Object: Embeds a copy of the entire Excel work-
book (the default).
– Picture: Pastes the chart as a picture.
– Picture (Enhanced Metafile): Pastes the chart as a picture; produces
the same result as the previous one.
The Paste link options:
Common Chart-Making
Mistakes
In a perfect world, every chart you create is a work of art that communicates a
message clearly and efficiently. In the real world, of course, charts are subject
to a wide variety of problems.
31
SECTION 5. COMMON CHART-MAKING MISTAKES 32
The choice of colors used in the chart. A chart the looks great in
color may be incomprehensible when printed on a black-and-white printer,
photocopied, or faxed.
In addition, consider these general strategies for creating more effective graphs:1
1 One graph is more effective than another if its quantitative information can be decoded