0% found this document useful (0 votes)
8 views

Plotting Graphs in Excel - 230915

This document provides instructions for plotting graphs in Excel using sample seafood consumption data. It includes an Excel 101 section explaining basic Excel functions and concepts. It then gives step-by-step instructions for plotting specific graph types using the sample data, including bar graphs, scatter plots, and pie charts. Exercises are provided for students to practice independently plotting graphs using formulas and functions.

Uploaded by

Maestro Yu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Plotting Graphs in Excel - 230915

This document provides instructions for plotting graphs in Excel using sample seafood consumption data. It includes an Excel 101 section explaining basic Excel functions and concepts. It then gives step-by-step instructions for plotting specific graph types using the sample data, including bar graphs, scatter plots, and pie charts. Exercises are provided for students to practice independently plotting graphs using formulas and functions.

Uploaded by

Maestro Yu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Graphs-2

(Demonstration and practice)

CCC8013 The Process of Science


Lab 3
Intended Learning Outcomes
By the end of this course, a fully engaged student should be able to:

• Navigate in the Excel environment for basic operations (e.g. data

entry, sorting, using formula etc)

• Plot graphs using Excel


Brief recap of last tutorial
• You have learnt bar graph, line graph, scatter plot and pie charts
• How can we make them????
Plotting your own data
• Download the Excel file “graphPlotting8013_T4” from Moodle

• Go to https://forms.gle/DB7pj1bzqKxu9eUT8 to fill in a questionnaire


on your habits in seafood consumption

• When everyone in the class has done the data input – go to


https://docs.google.com/spreadsheets/d/1xSYUbptAf4JqbayLb5itf68
RCou7qKfpSREPLIuuxr4/edit?usp=sharing to copy and paste
everything onto the sheet “data page” in your Excel file

• Some basic Excel 101 before plotting …


Excel 101
• Excel is a software to tabulate, collate and organize data on
spreadsheets – can be in various forms (e.g. numbers, text etc)
• Functionality for data sorting, graph plotting to visualize data etc
Excel 101
• Cells are located using column letter (A, B, C …) and row number (1, 2,
3 …) – so every cell can be located uniquely

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

• Let’s start plotting!


Excel 101
• We can plot graphs by having data in some columns, highlighting
them, and clicking one of the graph options in “Insert” tab in the top
menu bar
• Need to have a set of data in the spreadsheet for graph plotting
Excel 101

Wall Street Mojo


Plotting your own data
• Patterns of seafood awareness between genders
• A bar graph showing variations in the average seafood awareness
score vs gender
• How to use the “sumif” and “countif” functions?
• Simple average = sum of values / number of values
Plotting your own data
• Patterns of seafood awareness vs willingness to pay
• A scatter plot showing the relationship between seafood awareness
score and the willingness to pay extra
Plotting your own data
• Patterns of knowledge on eco-labels, seafood consumption frequency,
and knowledge on fish stock decline (price of a wild caught croaker)
• Three pie charts
• Note the use of “countif” function
Plotting your own data
• Temporal variation in fisheries capture in Hong Kong
• Line graph showing how fisheries capture in Hong Kong changed with
time
Exercise for you …
• Go to the “exercise” sheet in your Excel file
• Try complete the following on your own!
• Fill in empty cells in the tables (bar graph and pie chart) using formula
• Plot a bar graph showing variations in average awareness score vs gender
• Plot a pie chart to show the distribution of income groups
• Plot a scatter plot between awareness and behaviour scores for male and
female within the same graph
• Tips:
• Use the functions “sumif” and “countif”
• Use “sort” to group values from different groups
• Check out the procedures at the end of this PPT
• Next tutorial we will practice

Means & correlation

… please also bring your device for Excel exercises!


• Graph plotting procedures
Plotting bar graph

City Area (km2) Highlight both columns (excluding title), go to


Bangkok 1569
Insert => Bar charts (first option in “2-D column”)
Hong Kong 1114 1800

Singapore 728.6 1600

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

1200 Choose to include


1000
different chart elements
800

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

E.g. Right-clicking the axis


1800

1600

1400

1200
Land area (km2)

1000

800

600

400

200

0 Can delete background grids by


Bangkok Hong Kong Singapore Taipei
City
left-clicking and deleting
Microsoft support
Plotting bar graph

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

40 But we don’t need this


35 space …
30
25
20
15
10
Format min or max values
5
of axes
0
0.0 5.0 10.0 15.0
Park area (ha)
Plotting scatter plot

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.15 Click “Add” and drag


through the data you need
0.1 (for both x and y), name
1995 2005 2015 2025 the series properly
Year Microsoft support
Plotting line graph
Click the graph, go to
0.45 the + sign symbol to
0.4 add legend
GDP (trillion USD)

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!

primary secondary tertiary others


Plotting pie chart
Repeat all the labelling and formatting … right click to
explore data labelling options

Click the graph, go to


4 10
the + sign symbol

53

52
On Mac
Chart Design →
Add Chart Element

primary secondary tertiary others


Microsoft support
Plotting pie chart

3% 8%
Right click the number
to format data labels
(display values,
positions etc)
45%

44%

primary secondary tertiary others


ExtendOffice
• Adjust graph components to increase readability for written and oral
presentations
Basic components: x and y axes
0.4

0.35

0.3
GDP (trillion USD)
0.25

Y-axis 0.2 GDP of Hong Kong over time


(Source: The World Bank)
0.15

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

Response variable – 0.15


something influenced
0.1
by/associated with x
0.05

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

0.35 Both axes will


GDP (trillion USD)
0.3 need variable
0.25 names and units!

Y-axis 0.2

Response variable – 0.15


something influenced
0.1
by/associated with x
0.05

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

You might also like