Plotting Graphs in Excel - 230915
Plotting Graphs in Excel - 230915
This is cell A1
This is cell C7
Excel 101
• A set of numbers from multiple cells form an array, denoted as
starting cell position : ending cell position (e.g. A1:A10 = from cell A1
to cell A10)
• Specifying cell locations/arrays is needed for formula
Highlighting the
array A1:A10
Excel 101
• You can enter or copy & paste data to the cells you want
• Data in the spreadsheet form the basis of other operations e.g.
sorting and graph plotting
Excel 101
• Data can be sorted according to groups by the “Sort” function in the
“Data” tab of the top menu bar
• Aligning data according to values in other columns
Excel 101
Sort by
“group”
Data grouped
Highlighting the by A, B and C
header
eduCBA
Excel 101
On Mac
Highlighting the
data
Excel 101
• We can use formula in Excel to generate numbers for plotting (e.g.
average, count number etc)
• To use formula, start by typing “ = “ (equal sign) in the cell, then Excel
will know you are going to key in a formula
• Formula can be used for ordinary mathematical operations
• e.g. +, - ,* or /
• =A2/A1 means to ask Excel to divide the value in A2 by the value in A1
• =B4*C5 means to ask Excel to multiply values in B4 and C5
Excel 101
• Formula can be used to implement functions, which are structured as
• =function name(input1, input2 …)
=average(…)
Simple average
=sumif(…)
=countif(…) Summing values according to some criteria
Counting number of cells
following a certain criteria
Excel 101
• Some useful functions for graph plotting:
• =sumif() – getting the sum of numbers based on cell values in the
same/another array – useful to get averages from
questionnaires/Google forms
• =countif () – getting the number of cells if certain criteria is true –
useful to get frequency of events for pie charts
• =average() – simple averages of numbers
1400
Taipei 271.8
1200
1000
800
600
400
200
0
Bangkok Hong Kong Singapore Taipei
Plotting bar graph
Adding axis label
Click the graph, go to
the + sign symbol
1800
1600
1400
600
400
200
Go to Chart Design →
0
Bangkok Hong Kong Singapore Taipei On Mac
Add Chart Element
Plotting bar graph
This looks rudimentary … right-click the graph components and format. Key
elements = axis sizes, labels, ticks, font sizes and symbol sizes
1600
1400
1200
Land area (km2)
1000
800
600
400
200
1800
1600
Land area (km2)
1400
1200
1000
800
600
400
200
0
Bangkok Hong Kong Singapore Taipei
City
Plotting scatter plot
area (ha) number of species
8.0 26
9.8 31
11.7 29 Highlight both columns (excluding title), go to
10.3 31
8.4
12.0
20
43
Insert => Scatter plot (first option in “Scatter Chart”)
10.7 30
11.3 39
9.7 24 50
11.5 25
12.2 30 45
9.8 38
12.3 38 40
7.3 25
11.5 39 35
11.4 27
7.1 25 30
9.0 24
12.3 40 25
8.5 23
13.2 39 20
9.5 22
12.1 39 15
10.8 40
11.6 36 10
8.8 26
12.5 33 5
12.2 34
10.6 29 0
8.7 27 0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0
Plotting scatter plot
We go through previous steps in adding axis labels and formatting
(make symbols larger!)
50
45
Number of species
40
35
30
25
20
15
10
5
0
0.0 5.0 10.0 15.0
Park area (ha)
Plotting scatter plot
We go through previous steps in adding axis labels and formatting
50
45
Number of species
45
Number of species
40
35
30
25
20
15
5.0 7.0 9.0 11.0 13.0 15.0
Park area (ha)
Plotting line graph
year HK GDP (trillion USD)
2000 0.171668 Highlight both columns (excluding title), go to
2001 0.169403
2002
2003
0.166349
0.161385
Insert => Scatter plot (the line options in “Scatter Chart”)
2004 0.1691
2005 0.18157
2006 0.193536 0.4
2007 0.211597
2008 0.21928
2009 0.214046 0.35
2010 0.228638
2011 0.248514 0.3
2012 0.262629
2013 0.275697 0.25
2014 0.291459
2015 0.309384
0.2
2016 0.320858
2017 0.341273
2018 0.361731 0.15
2019 0.363052
2020 0.344932 0.1
2021 0.369176
0.05
0
1995 2000 2005 2010 2015 2020 2025
Plotting line graph
Repeat all the labelling and formatting …
0.4
0.35
GDP (trillion USD)
0.3
0.25
0.2
0.15
0.1
1995 2005 2015 2025
Year
Plotting line graph
Adding another series ?
0.4
E.g. Right-clicking the graph
0.35
GDP (trillion USD)
0.3 On Mac
0.25
0.2
0.35
0.3
0.25
0.2 On Mac
0.15 Click the graph, go to
0.1 Chart Design →
Add Chart Element
0.05
to add legend
0
1995 2005 2015 2025
Year
Plotting line graph
0.45
0.4
GDP (trillion USD)
0.35
0.3
0.25
0.2 Hong Kong
Singapore
0.15
0.1
0.05
0
1995 2005 2015 2025
Year
Plotting pie chart
education level number
primary 10 Highlight both columns (excluding title), go to
secondary 52
tertiary 53 Insert => Pie chart (the first option in 2-D Pie)
others 4 *No need to recalculate percentages yourself!
53
52
On Mac
Chart Design →
Add Chart Element
3% 8%
Right click the number
to format data labels
(display values,
positions etc)
45%
44%
0.35
0.3
GDP (trillion USD)
0.25
0.1
0.05
0
1960 1970 1980 1990 2000 2010 2020 2030
Year
X-axis
Basic components: x and y axes
0.4
0.35
0.3
GDP (trillion USD)
0.25
Y-axis 0.2
0
1960 1970 1980 1990 2000 2010 2020 2030
Year
Explanatory variable – something
X-axis influencing/associating with y
Basic components: x and y axes
0.4
Y-axis 0.2
0
1960 1970 1980 1990 2000 2010 2020 2030
Year
Explanatory variable – something
X-axis influencing/associating with y
Large and clear fonts/symbols
0.4
0.35
Fonts need to be
0.3
GDP (trillion USD) large and clear, avoid
small fonts
0.25
Y-axis 0.2
0.15
0.1
0.05
0
1960 1970 1980 1990 2000 2010 2020 2030
Year
X-axis
Large and clear fonts/symbols
0.4
0.35
0.3
GDP (trillion USD)
0.25
Y-axis 0.2
0.15
Symbols and lines need to
0.1 be large/thick/clear as well
0.05
0
1960 1970 1980 1990 2000 2010 2020 2030
Year
X-axis
Large and clear fonts/symbols
0.4
0.35
0.3
GDP (trillion USD)
Hong Kong
0.25
Singapore
Add in a clear legend if
Y-axis 0.2
necessary (e.g. when having
0.15 multiple series in a single graph)
0.1
0.05
0
1960 1970 1980 1990 2000 2010 2020 2030
Year
X-axis