02basic Charts and Plots

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

King Saud University

Muzahimya Branch FromTableau Software


College of Computer & Information Sciences

ISY 358: Data Visualization

Lecture 2
Basic Charts and Plots

Prof. Mourad Ykhlef


The slides content is derived and adapted from many references

From Tableau Software Tableau: Interactive Mashups

3 72
Content Scatter Plot
• Scatter plot • Range Bar Chart
• Line Chart • Bullet Chart
• (Stacked) Area Chart • Box Plot
• (Multi-set) Bar Chart • Pie Chart
• Histogram • Donut Chart
• (Stacked) Bar Chart

5 6
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

Year 1950 1955 1960 1965 1970 1975 1980 1985 1990 1995
# of
201 593 616 897 654 919 866 684 1133 1234
Tornadoes

• An effective way to see a relationship in data is to 1200

display the information as a __________________.


scatter plot •
1000
• It shows how two variables relate to each other by •
fit
showing how closely the data points _______ to a line. •

800
• The following table presents information on tornado
occurrences. • •
600 •

Year 1950 1955 1960 1965 1970 1975 1980 1985 1990 1995
400 Do you notice a trend?
# of
201 593 616 897 654 919 866 684 1133 1234
Tornadoes

200 •
1950

1955

1960

1965

1970

1975

1980

1985

1990

1995
Basic Charts and Plots- Prof. Mourad Ykhlef
Scatter plots provide a convenient way to determine
correlation exists between two variables.
whether a ___________

positive
A __________ correlation occurs when both •
• • •
variables increase. •
•• • •
• • •
• •
• • •
negative
A ___________ correlation occurs when one variable
• •• •
• •
• •
increases and the other variable decreases. •

If the data points are randomly scattered there is Positive Negative little or no
little
_______ or no correlation. correlation correlation correlation

Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

Example 1: Sometimes points on a scatter plot are represented by


The scatter plots of data relate characteristics of children from line of best fit
a trend line or a _______________________.
0 to 18 years old.
You can study the line to see how the data behaves. You may
Match each scatter plot with the appropriate variables studied.
have a basis predict what the data might be for values not
1. age and height
given.
2. age and eye color
3. age and time needed to run a certain distance


• Example 2: Find the line of best fit for the scatter plot you made
• •• • • •

• • • • on the first page. To fit the line to the points, choose your line so
• • • that it best matches the overall trend. The line does not have to
• •
• • ••
• • pass through any of the points.
• •
no correlation
as your age increases as your age
between age
your height also increases increases the time
and eye color
will decrease
2 1 3 Basic Charts and Plots- Prof. Mourad Ykhlef
Use the line of best fit to predict how many tornadoes may be
reported in the United States in 2015 if the trend continues.
If the data points are close to the line of best fit, it is
1200 said to have a ___________correlation.
strong


1000 ••
• • • • •
• •• •• •• •• •
• • • •
• • • ••
800 • • •

• •

600 • strong positive
• weak positive

If the trend continues •


400 • •
we predict that there • •
will be 1200 tornadoes • • •
• •••
reported in 2015. • ••
200 • • •
• • •
••
• •

weak negative strong negative


1950

1955

1960

1965

1970

1975

1980

1985

1990

1995

2000

2005

2010

2015

How to compute correlation How to compute correlation


• For the following two vectors, x and y, find the correlation.
– X = (4, 4, 3, 1, 0, 5, 3, 4, 4, 3)
– Y = (3, 4, 3, 3, 2, 4, 4, 4, 5, 4)

– If rx,y =0 then x and y are independent.


– If rx,y >0 then x and y are positively correlated, the values of x increase as the values of y
increase.
– If rx,y <0 then x and y are negatively correlated, the values of one attribute increase as the
values of the other attribute decrease.

Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Line Graph
• A line graph is a graph used to show
change over time!!

•What can time be measured in???


•Seconds - Minutes - Hours – Days -
Weeks - Months – Years - Decades -
Centuries - etc.
18
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

When to use a line graph? How do we make a line


Would we use a line graph
graph?
in the following situations: A line graph ALWAYS has a
•To show how many people like pizza in title!
this class? NO A line graph has two different
axis’s
Y
•To show how much it rained each month An axis is either the horizontal
this year? YES- because months and years deal with time. line (called x) or the vertical line
X (called y) that form the base
•To show how many people live in East lines of a graph.
Meadow? NO
19 20
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
X-axis and Y-axis Intervals
When we are setting up a line graph, we
When you are making a line graph, the need to decide what intervals we want to
x-axis is always horizontal, and the y- use.
axis is always vertical. If we are graphing the temperature for a
year, do we want to put 365 days on the
The x and y-axis usually starts with zero graph, and 100 different temperatures?
on a line graph When we see a horizontal flat line, that
It is important to make sure that the means that there was no change during a
intervals on our y-axis are always equal. specific time period.
What do I mean by this?

21 22
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

Plotting a Line graph


When we are plotting a line graph, it is Is this an acceptable graph?
important to read what information is on
each axis. Car Trip
There must be a label on each axis that
describes the information.
Much like a bar graph, we look at the x-axis
first in order to plot our points.

Time
23 24
Time in minutes
Money spent this week Miles traveled during the week
$25.00 70
60
Amoutn of $

$20.00

Miles Traveled
50
$15.00 40
$10.00 30
20
$5.00
10
$0.00 0
Mon. Tues. Wed. Thurs. Fri. Mon. Tues. Wed. Thurs. Fri. Sat. Sun.
Day Days

25 26

U.S. Corn in Acres


Calories burned while running
85
Acres of corn (in millions)

240
80 220
200
75 180
160

Calories
70 140
120
65 100
80
60 60
40
55 20
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001

0
30

60

90

120

150

180

210

240

270
Years Hours

27 28
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Do these have the same information on them? (Stacked) Area chart
Test grades

100

Source 50

0
1 2 3 4 5 6
Week

Test grades

90
Source

85
80
75
70
1 2 3 4 5 6
Week 29 30
Basic Charts and Plots- Prof. Mourad Ykhlef

Area Chart Simple Area Chart


• Area Charts (Graphs) are Line Graphs with the area below
the line filled in with a certain color or texture.
• Like Line Graphs, Area charts are used to display the
development of quantitative values over an interval or time
period.
• They are most commonly used to show trends and
relationships, rather then convey specific values.
• Two popular variations of Area Graphs are:
– Simple Area Chart
– Stacked Area Charts

31 32
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Stacked Area Charts
• Stacked Area Charts (Graphs) work in the same way as
simple Area Graphs do, except for the use of multiple data
series that start each point from the point left by the
previous data series.
• The entire graph represents the total of all the data plotted.
• Stacked Area Graphs also use area to convey whole
numbers,
so they do not work for negative values.
• Overall, they are useful for comparing multiple variables
changing over an interval.
33 34
Basic Charts and Plots- Prof. Mourad Ykhlef

Bar Chart = Bar Graph


What do you know about
• A bar chart can
Spanish be used to display
• bar chart? and compare data
• double bar graph? Mandarin • The scale should
include all the
• Histogram? Hindi
data values and
be easily divided
into equal
English intervals.

0 200 400 600 800 1000

Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
How to interpret a Bar Chart?
Double Bar Chart
The bar chart shows Mr. Ahmed’s students
by gender and band membership.
90 • Can be used to
80 compare two
70
• How many of Mr.

7
related sets of
60
Ahmed’s students are data

6
50
band members?

5
40
• How many of Mr. 30

4
20
Ahmed’s students are 3 10
not band members?
2

0
1st 2nd 3rd 4th
1

Qtr Qtr Qtr Qtr


0

Female Female not Male band Male not


band band band

Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

How to make a Double-Bar The table shows the highway speed limits on
Chart? interstate roads within three states
State Urban Rural
• Choose a scale and interval for the vertical axis.
• Draw a pair of bars for each country’s data. Use
different colors to show males and females. Florida 65mi/h 70 mi/h
• Label the axes and give the chart a title.
title.
• Make a key to show what each bar represents.
Texas 70 mi/h 70 mi/h

Vermont 55mi/h 65 mi/h

Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Step 1 Step 2
• Draw a pair of bars for each state’s
• Choose a scale and 80 data. Use different colors to show
interval for the urban and rural.
vertical axis.
60 80

State Urban Rural


40 Florida 65mi/h 70 mi/h 60

State Urban Rural Texas 70 mi/h 70 mi/h


40
Florida 65mi/h 70 mi/h 20 Vermont 55mi/h 65 mi/h

Texas 70 mi/h 70 mi/h 20


Vermont 55mi/h 65 mi/h 0

0
Florida Texas Vermont

Step 3 and 4
Speed Limit on Interstate Roads
Multiset Bar Chart
80
• Label the axes and Urban • Double Bar Chart
give the graph a title. Rural
• Triple Bar Chart
Speed Limit (mi/h)

60
• Make a key to show
what each bar • ------
40
represents
• Multiset Bar Chart
20

0
Florida Texas Vermont

44
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
The table below shows the number of hours students
watch TV in one week Make a histogram of all the data.
Histogram
Number of hours of TV
• Histogram is a bar graph that shows the frequency
of data within equal intervals. 1 II 6 III
• There is no space in between the bars.
2 IIII 7 IIII - IIII
• The main difference between bar charts and
histograms. 3 IIII - IIII 8 III
– With bar charts, each column represents a
group defined by a categorical variable; 4 IIII - I 9 IIII
– and with histograms, each column represents a
group defined by a continuous, quantitative 5 IIII - III
variable.
Basic Charts and Plots- Prof. Mourad Ykhlef

Step 1 Step 2
• Choose an appropriate scale and interval for the vertical axis. The
• Make a frequency table of the data. Be sure to use equal greatest value on the scale should be at least as great as the
intervals greatest frequency.

20
Number of hours of TV Number of Frequency Number of Frequency 16
1 II 6 III hours of TV hours of TV 12
2 IIII 7 IIII - IIII
8
3 IIII - IIII 8 III 1-3 15 1-3 15
4-6 17 4-6 17 4
4 IIII - I 9 IIII
5 IIII - III 7-9 16 7-9 16 0
1-3 4-6 7-9

Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Step 3 Can you now make a bar graph,
• Draw a bar for each interval. The Hours of Television
height of the bar is the frequency Watched
double bar Graph and a histogram?
for that interval. Bars must touch
but not overlap.
20
• Label the axes and give the graph
title The list below shows the results of a typing

Number of students
16

12
test in words per minute. Make a histogram
Number of
of the data.
Frequency 8
hours of TV 62, 55, 68, 47, 50, 41, 62, 39, 54, 70, 56, 70,
4
56, 47, 71, 55, 60, 42
1-3 15 0
4-6 17 1-3 4-6 7-9
Hours
7-9 16
Basic Charts and Plots- Prof. Mourad Ykhlef

Stacked Bar Chart


• A stacked bar chart is a chart that uses bars to show comparisons
between categories of data, but with ability to break down and
compare parts of a whole.
– Each bar in the chart represents a whole, and segments in the bar represent different
parts or categories of that whole.
• Stacked bars do a good job of featuring the total and also providing a
hint as to how the total for each category value is divided into parts.
• The bars can be either horizontal or vertical.
• Stacked Bar graph can have one category axis and up to two
numerical axes. Category axis describes the types of categories being
compared, and the numerical axes represent the values of the data.
• Stacked Bar graph can be used to represent: Ranking, Nominal
Comparisons, Part-to-whole, Deviation, or Distribution.
51 52
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Simple Stacked Bar Chart

There are two types of Stacked Bar Charts:


Simple Stacked Bar Charts
100% Stack Bar Charts

53 54
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

Range Bar Chart


100% stacked column chart

55 56
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Also known as: Range Bar/Column Chart, Floating Bullet Chart
Bar Chart, Span Chart.
A chart used to display dataset ranges between a
minimum value and a maximum value. It is ideal for
making comparisons of ranges labeled with
categories.
It focuses the reader on only the extreme values and
give no information on the values in between the
minimum and maximum values or on averages or
data distribution.

57 58
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

Used typically to display performance data, Bullet Graphs


functions like a Bar Chart, but are accompanied by extra
visual elements to pack in more context.
The main data value is encoded by length in main bar in
the middle of the chart, which is known as the "Feature
Measure".
"Comparative Measure" is used as a target marker to
compare against the Feature Measure value.
The segmented colored bars behind the Feature Measure
are used to display qualitative range scores. For
example, poor, average and great.
When using Bullet Graphs, it's ideal to keep the maximum
number of ranges to five.

59 60
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
MEAN, MEDIAN, MODE
Box Plot or Whisker Plot

61 62
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

Box-and-whisker plots are a handy way to display data broken into


four quartiles, each with an equal number of data values. The box-
and-whisker plot doesn't show frequency, and it doesn't display each
individual statistic, but it clearly shows where the middle of the data
lies. It's a nice plot to use when analyzing how your data is skewed.
There are a few important vocabulary terms to know in order to
graph a box-and-whisker plot. Here they are:

Q1 – quartile 1, the median of the lower half of the data set


Q2 – quartile 2, the median of the entire data set
Q3 – quartile 3, the median of the upper half of the data set
IQR – interquartile range, the difference from Q3 to Q1
Extreme Values – the smallest and largest values in a data set

63
Basic Charts and Plots- Prof. Mourad Ykhlef
Box plot and Outliers

65 66
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

67 68
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Pie Chart
Pie charts
• Aim – visual detection of differences on proportion among several
classes
• Limitation – easy interpretation only with a few data

69 70
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

Pie charts Pie charts : guidelines


• Use with caution – close numeric values are not easily •Use only if you need to show how are
comparable distributed 100% of a data.
•Better works with only 2 to 4 classes
•Always consider bar charts as an alternative

71 72
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef
Pie charts : guidelines
• No axe : add labels to show the value of each class, if it is important for the interpretation.
• Labels near the slices rather than a separate legend (particularly with more than 3 classes)

• Order segment by value to ease comparisons


• Careful attention to color coding
• Avoid 12-o’clock position for the slices radii [Hollands, 2003]

73 74
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

Donut Chart Donut Chart


• A donut chart is essentially a Pie Chart with an area of the centre cut
out.
• Pie Charts are sometimes criticized for focusing readers on the
proportional areas of the slices to one another and to the chart as a
whole. This makes it tricky to see the differences between slices,
especially when you try to compare multiple Pie Charts together.
• A Donut Chart somewhat remedies this problem by de-emphasizing
the use of the area. Instead, readers focus more on reading the length of
the arcs, rather than comparing the proportions between slices.
• Also, Donut Charts are more space-efficient than Pie Charts because
the blank space inside a Donut Chart can be used to display
information inside it.

75 76
Basic Charts and Plots- Prof. Mourad Ykhlef Basic Charts and Plots- Prof. Mourad Ykhlef

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy