Lecture 8 tables axes

advertisement
Lecture 8: tables, text annotations,
mathematical expressions, legends,
custom axes
Trevor A. Branch
tbranch@uw.edu
Beautiful graphics in R, FISH507H
SAFS, University of Washington
Spring quarter classes in R
• I run FISH458 on solving real-life conservation
problems through fitting models to data (R
coding required, FISH454 helpful, 4 credits)
• New class FISH512 Super-Advanced R run by
my lab on structured programming, speeding
up R, including C++ code, dplyr, ggplot2,
object-oriented code, creating R packages,
and GitHub (2 credits).
Reminder
Project drafts due in class 10 March for all
figures. There will be a series of “speedreviewing” small groups for feedback from
classmates. For best results, make sure your
plots are as complete and perfect as possible.
Creator, Paul Butler: “When I tell people I used R, the reaction I get is roughly
what I would expect if I told them I made it with Microsoft Paint and a bottle of Jägermeister.”
Plotted from most to least connected cities in order (overplotting), and used
colorRampPalette(c("black","blue","white")) to plot more connected cities in whiter color.
Transparent colors did not work: too many lines and minimum transparency not enough.
Random sample of 10 million pairs of friends.
http://paulbutler.org/archives/visualizing-facebook-friends/
Tables vs. figures
• Day (1998) “How to write and publish a scientific paper” Oryx
Press, Phoenix, AZ.
• Tufte (1990) “Envisioning information” Cheshire, CT: Graphics
Press
• Tufte (2006) “Beautiful evidence” Cheshire, CT: Graphics Press
• Gelman, Andrew (2011). Why tables are really much better
than graphs. Journal of Computational and Graphical Statistics
20:3-7 [plus responses by William Briggs, Michael Friendly,
Ernest Kwan, Howard Wainer, Graham Wills; and a rejoinder]
• Few (2004) “Show me the numbers” Analytics Press, Oakland,
CA
Day (2006) How to write and publish a scientific paper, p. 65
Courtroom chart by reputed mobster John Gotti's lawyers, listing Government witnesses’
criminal activities.
Tufte (1990) Envisioning information, p. 31
Train timetables: 1396 numbers and periods
Tufte (1990) Envisioning information, p. 46-47
Train timetables: 619 characters (777 fewer)
Keihin Express Line, Yokohama Station, Sagami Tetsudo Company, 1985 timetable, p. 76
Tufte (1990) Envisioning information, p. 46-47
Brenner (2002)
Tufte redesign
Brenner (2002) The Lancet 360:1131-1135
Tufte (2006) Beautiful evidence, p. 174
Tufte (2006) Beautiful evidence, p. 175
Gelman (2011)
“Graphs are gimmicks, substituting fancy displays for careful analysis
and rigorous reasoning. It is basically a trade-off: the snazzier your
display, the more you can get away with a crappy underlying analysis.
Conversely, a good analysis does not need a fancy graph to sell itself.
The best quantitative research has an underlying clarity and a
substantive importance whose results are best presented in a sober,
serious tabular display. And the best quantitative researchers trust
their peers enough to present their estimates and standard errors
directly, with no tricks, for all to see and evaluate. Let us leave the dot
plots, pie charts, moving zip charts, and all the rest to the folks in the
marketing department and the art directors of Newsweek and USA
Today. As scientists we are doing actual research and we want to see,
and present, the hard numbers.”
Gelman (2011) Journal of Computational and Graphical Statistics 20(1): 3-7
Friendly & Kwan (2011) Journal of Computational and Graphical Statistics 20(1): 18-27
Proportion of flights canceled by day of the year
Wills (2011) Journal of Computational and Graphical Statistics 20:28-35
Proportion of flights canceled by day of the year
Wills (2011) Journal of Computational and Graphical Statistics 20:28-35
Proportion of
flights canceled by
day of the year
Wills (2011) Journal of Computational and Graphical Statistics 20:28-35
Conditional
formatting in Excel
(under Home
ribbon)
Day
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
J
2.1%
3.2%
3.0%
3.2%
2.7%
3.6%
4.8%
5.2%
3.5%
2.4%
3.4%
3.7%
3.0%
3.1%
2.8%
2.8%
3.4%
3.8%
3.1%
2.8%
2.5%
3.2%
3.2%
1.8%
3.7%
3.0%
3.1%
2.7%
3.3%
2.8%
2.3%
F
2.3%
2.5%
2.7%
3.2%
3.0%
3.4%
2.1%
2.6%
2.4%
2.3%
3.6%
3.8%
3.3%
3.6%
2.3%
3.1%
3.1%
2.9%
1.6%
1.5%
2.4%
2.7%
2.2%
2.9%
3.4%
2.2%
1.4%
1.8%
1.3%
M
1.9%
2.5%
2.2%
2.8%
3.1%
3.5%
2.4%
3.0%
2.9%
2.0%
1.6%
1.6%
3.3%
2.9%
1.8%
2.9%
1.8%
2.3%
1.9%
1.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3%
1.2%
1.3%
1.3%
1.1%
1.2%
1.0%
1.2%
1.2%
1.3%
1.3%
1.3%
1.2%
1.0%
0.9%
1.0%
1.3%
1.5%
1.7%
1.4%
1.3%
1.1%
1.2%
1.5%
N
1.4%
1.3%
1.1%
1.1%
1.2%
1.3%
1.1%
1.1%
0.9%
1.3%
1.4%
1.4%
1.3%
1.4%
1.8%
1.8%
1.3%
1.1%
1.4%
1.3%
1.2%
1.3%
1.3%
1.1%
0.8%
0.8%
0.8%
0.9%
1.1%
1.4%
D
2.1%
1.5%
1.6%
1.5%
2.3%
2.1%
1.9%
2.2%
2.5%
2.3%
3.2%
2.3%
2.7%
2.7%
2.9%
2.4%
2.0%
1.9%
2.5%
2.2%
2.5%
2.1%
2.7%
2.0%
2.3%
2.5%
2.3%
2.6%
2.3%
2.9%
2.2%
Text annotations
Tufte (2006) Beautiful evidence, p. 118
Original: Sagan (1977) The dragons of Eden
Tufte (2006) Beautiful evidence, p. 119
Tufte (2006) Beautiful evidence, p. 120
Tufte (2006) Beautiful evidence, p. 120
Redrawn from Worm et al. (2009) Science 325:578-585
Redrawn from Worm et al. (2009) Science 325:578-585
Download