02 large
DESCRIPTION
TRANSCRIPT
![Page 1: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/1.jpg)
Hadley Wickham
Stat405Graphics for large data
Thursday, 26 August 2010
![Page 2: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/2.jpg)
Majoring in Stat
• Declare early (even if you’re not sure)
• Weekly lunches
• Summer opportunities (research & internships)
Thursday, 26 August 2010
![Page 3: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/3.jpg)
1. Leftovers from last lecture
2. The diamonds data
3. Histograms and bar charts
4. More boxplots and scatterplots
5. Homework
Thursday, 26 August 2010
![Page 4: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/4.jpg)
reorder(class, hwy)
hwy
15
20
25
30
35
40
●
●●
●
●●
●
●
●
●
●
● ●
●
●
●●
●
●
●●
● ●
●
●
●
● ●
●
●
●●
● ●
●
●
●●
●
●
●
●●●
●
●
●
●
●
●●
●●
●
●
●●
●
●
●●
●
●
●
●
●
●
●●
●
●
●
●●
● ●
●●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●●
●●
●●
●
●
●
●●
●
●
●
●
●●
●
●
●
●
●
●
● ●
●
●
●
●●
●
●
●
●
●●
●●
●●●
●
●
●
●
●
●
●●
●●●
●
●
●●● ●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●●
●
●
●
●
●
●●●
●●●
●
●
●
●
●
●●
●●
●
●
●●
●
●
●
●
●
● ●●
●
●
●
●
●
●
●●
●
●●
●●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●●
●●
●
●
pickup suv minivan 2seater midsize subcompact compactqplot(reorder(class, hwy), hwy, data = mpg, geom = "jitter")
# Remember: start withlibrary(ggplot2)
Thursday, 26 August 2010
![Page 5: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/5.jpg)
reorder(class, hwy)
hwy
15
20
25
30
35
40
●●●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●
pickup suv minivan 2seater midsize subcompact compactqplot(reorder(class, hwy), hwy, data = mpg, geom = "boxplot")Thursday, 26 August 2010
![Page 6: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/6.jpg)
reorder(class, hwy)
hwy
15
20
25
30
35
40
●
●
●●
●●
●
●
●
●
●
●●
●
●
●
●
●
●
●●
●●
●
●
●
● ●
●
●
●
●
● ●
●
●
●●
●
●
●
●●●
●
●
●
●
●
● ●●
●
●
●
●●
●
●
●
●
●
●
●
●
●●
●●
●
●
●
●
●
●●
●●●
●
●
●
●
●
●
●
●
● ●●
●
●
●
●
●
●●
●●
●●
●
●
●
● ●
●
●
●●
●●
●
●
●
●
●
●
●●
●
●
●
●●
●
●
●
●
●●
●●
●●
●
●
●
●
●
● ●
●●
●
●●
●
●
●●
● ●
●
●
●
●●
●
●
●
●
● ●
●
●
●
● ●
●
●
●
●
●
●●●
● ●
●●
●
●
●
●
●
● ●●
●
●
●●
●
●
●
●
●
●●●
●
●
●
●
●
●
●●
●
●●
●●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●●
●●
●
●
●●●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●
pickup suv minivan 2seater midsize subcompact compactqplot(reorder(class, hwy), hwy, data = mpg, geom = c("jitter", "boxplot"))Thursday, 26 August 2010
![Page 7: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/7.jpg)
Your turn
Read the help for reorder. Redraw the previous plots with class ordered by median hwy.
How would you put the jittered points on top of the boxplots?
Thursday, 26 August 2010
![Page 8: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/8.jpg)
Diamonds
Thursday, 26 August 2010
![Page 9: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/9.jpg)
Diamonds data
~54,000 round diamonds from http://www.diamondse.info/
Carat, colour, clarity, cut
Total depth, table, depth, width, height
Price
Thursday, 26 August 2010
![Page 10: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/10.jpg)
z
table width
x
depth = z / diameter
table = table width / x * 100
Thursday, 26 August 2010
![Page 11: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/11.jpg)
Recall
Write down five ways to inspect the diamonds dataset.
You have one minute!
Thursday, 26 August 2010
![Page 12: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/12.jpg)
Your turn
Inspect the data and familiarise yourself with the variables. If you don’t know what they mean, look them up on wikipedia.
Thursday, 26 August 2010
![Page 13: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/13.jpg)
Histogram & bar charts
Thursday, 26 August 2010
![Page 14: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/14.jpg)
Histograms and barcharts
Used to display the distribution of a variable
Categorical variable → bar chart
Continuous variable → histogram
Thursday, 26 August 2010
![Page 15: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/15.jpg)
Always experiment with the bin width!
Thursday, 26 August 2010
![Page 16: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/16.jpg)
Examples# With only one variable, qplot guesses that# you want a bar chart or histogramqplot(cut, data = diamonds)
qplot(carat, data = diamonds)qplot(carat, data = diamonds, binwidth = 1)qplot(carat, data = diamonds, binwidth = 0.1)qplot(carat, data = diamonds, binwidth = 0.01)resolution(diamonds$carat)
last_plot() + xlim(0, 3)
Thursday, 26 August 2010
![Page 17: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/17.jpg)
Examples# With only one variable, qplot guesses that# you want a bar chart or histogramqplot(cut, data = diamonds)
qplot(carat, data = diamonds)qplot(carat, data = diamonds, binwidth = 1)qplot(carat, data = diamonds, binwidth = 0.1)qplot(carat, data = diamonds, binwidth = 0.01)resolution(diamonds$carat)
last_plot() + xlim(0, 3)
Common ggplot2 technique: adding
together plot components
Thursday, 26 August 2010
![Page 18: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/18.jpg)
qplot(table, data = diamonds, binwidth = 1)
# To zoom in on a plot region use xlim() and ylim()qplot(table, data = diamonds, binwidth = 1) + xlim(50, 70)qplot(table, data = diamonds, binwidth = 0.1) + xlim(50, 70)qplot(table, data = diamonds, binwidth = 0.1) + xlim(50, 70) + ylim(0, 50)
# Note that this type of zooming discards data outside of the plot regions# See coord_cartesian() for an alternative
Thursday, 26 August 2010
![Page 19: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/19.jpg)
Additional variables
As with scatterplots can use aesthetics or faceting. Using aesthetics creates pretty, but ineffective, plots.
The following examples show the difference, when investigation the relationship between cut and depth.
Thursday, 26 August 2010
![Page 20: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/20.jpg)
depth
count
0
1000
2000
3000
4000
56 58 60 62 64 66 68 70
qplot(depth, data = diamonds, binwidth = 0.2)Thursday, 26 August 2010
![Page 21: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/21.jpg)
depth
coun
t
0
1000
2000
3000
4000
56 58 60 62 64 66 68 70
cutFairGoodVery GoodPremiumIdeal
qplot(depth, data = diamonds, binwidth = 0.2, fill = cut) + xlim(55, 70)Thursday, 26 August 2010
![Page 22: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/22.jpg)
depth
coun
t
0
1000
2000
3000
4000
56 58 60 62 64 66 68 70
cutFairGoodVery GoodPremiumIdeal
qplot(depth, data = diamonds, binwidth = 0.2, fill = cut) + xlim(55, 70)
Fill is the aesthetic for fill colour
Thursday, 26 August 2010
![Page 23: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/23.jpg)
depth
coun
t 0
500
1000
1500
2000
2500
0
500
1000
1500
2000
2500
Fair
Premium
56 58 60 62 64 66 68 70
Good
Ideal
56 58 60 62 64 66 68 70
Very Good
56 58 60 62 64 66 68 70qplot(depth, data = diamonds, binwidth = 0.2) + xlim(55, 70) + facet_wrap(~ cut)Thursday, 26 August 2010
![Page 24: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/24.jpg)
Your turn
Explore the distribution of price.
How does it vary with colour, or cut, and clarity?
Practice zooming in on regions of interest.
Thursday, 26 August 2010
![Page 25: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/25.jpg)
Box and whisker plots
Thursday, 26 August 2010
![Page 26: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/26.jpg)
Boxplots
Less information than a histogram, but take up much less space.
Already seen them used with discrete x values. Can also use with continuous x values, by specifying how we want the data grouped.
Thursday, 26 August 2010
![Page 27: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/27.jpg)
qplot(table, price, data = diamonds)Thursday, 26 August 2010
![Page 28: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/28.jpg)
table
price
5000
10000
15000
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
50 60 70 80 90
qplot(table, price, data = diamonds, geom = "boxplot")Thursday, 26 August 2010
![Page 29: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/29.jpg)
table
price
5000
10000
15000
●
●
●
●
●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●
●●●●●●●●
●●●●●●●●●●●●●●●●
●●
●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●
●●●●●
●●●●●●
●●●
●●●●●●●●●●
●●●●●●●●
●
●
●●●
●●●●●
●
●●
●
●●●
●
●●
●
●●●●●
●●●
●
●
●
●
●
●
●●●
●●
●●
●
●
●
●●
●
50 60 70 80 90qplot(table, price, data = diamonds, geom = "boxplot", group = round(table))
Thursday, 26 August 2010
![Page 30: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/30.jpg)
table
price
5000
10000
15000
●
●
●
●
●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●
●●●●●●●●
●●●●●●●●●●●●●●●●
●●
●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
●●●●●●●●●
●●●●●●●●●●●●●●●●●●●●
●●●●●
●●●●●●
●●●
●●●●●●●●●●
●●●●●●●●
●
●
●●●
●●●●●
●
●●
●
●●●
●
●●
●
●●●●●
●●●
●
●
●
●
●
●
●●●
●●
●●
●
●
●
●●
●
50 60 70 80 90qplot(table, price, data = diamonds, geom = "boxplot", group = round(table))
One boxplot for each unique value of this aesthetic
Thursday, 26 August 2010
![Page 31: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/31.jpg)
Scatterplots
Thursday, 26 August 2010
![Page 32: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/32.jpg)
• Global patterns
• Local patterns
• Deviations
Interpreting a scatterplot
Thursday, 26 August 2010
![Page 33: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/33.jpg)
Thursday, 26 August 2010
![Page 34: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/34.jpg)
Strong linear relationship.A number of outliers.
Thursday, 26 August 2010
![Page 35: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/35.jpg)
Thursday, 26 August 2010
![Page 36: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/36.jpg)
Unusual striations. Two groups? Little relationship between table and price?
Thursday, 26 August 2010
![Page 37: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/37.jpg)
Thursday, 26 August 2010
![Page 38: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/38.jpg)
Curved (exponential?) relationship. Outliers mostly cheaper than expected.
Thursday, 26 August 2010
![Page 39: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/39.jpg)
qplot(carat, price, data = diamonds)
But what’s the problem with
all these plots?
Thursday, 26 August 2010
![Page 40: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/40.jpg)
qplot(carat, price, data = diamonds)
But what’s the problem with
all these plots?In pairs, brainstorm
solutions for 2 minutes.
Thursday, 26 August 2010
![Page 41: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/41.jpg)
Idea ggplot
Small points shape = I(".")
Transparency alpha = I(1/50)
Jittering geom = "jitter"
Smooth curve geom = "smooth"
2d bins geom = "bin2d" or geom = "hex"
Density contours geom = "density2d"
Thursday, 26 August 2010
![Page 42: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/42.jpg)
Practice doing these plots yourself.
Read the online documentation for each plot type: http://had.co.nz/ggplot2
Your turn
Thursday, 26 August 2010
![Page 43: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/43.jpg)
Homework
Practice your graphics/data exploration skills with the diamonds or mpg data.
Due in one week.
Make sure to read the grading rubric, and find a colour printer.
Thursday, 26 August 2010
![Page 44: 02 Large](https://reader034.vdocuments.net/reader034/viewer/2022051513/54622d0caf7959422a8b4c23/html5/thumbnails/44.jpg)
Asking questions
You have two minutes to write down as many questions as you can come up with that you might want to answer about the diamonds data.
Write your best question on a piece of paper and turn it in.
Thursday, 26 August 2010