Creating effective figures and tables - Department of Biostatistics and ...

0 downloads 134 Views 2MB Size Report
Displaying data well. • Be accurate and clear. • Let the data speak. – Show as much ..... ER Tufte (1983) The visu
Creating effective figures and tables

Karl W Broman Biostatistics & Medical Informatics University of Wisconsin – Madison

kbroman.org github.com/kbroman @kwbroman Slides: bit.ly/CDHA2016

Displaying data well • Be accurate and clear. • Let the data speak. – Show as much information as possible, taking care not to obscure the message.

• Science not sales. – Avoid unnecessary frills (esp. gratuitous 3d).

• In tables, every digit should be meaningful. Don’t drop ending 0’s.

2

Show the data

3

Show the data

3

Show the data

3

Show the data

3

Show the data

3

Show the data

3

Avoid pie charts

4

Avoid pie charts

4

Avoid pie charts

4

Avoid pie charts B

B A

A C C

E

E D

D

via @MonaChalabi (bit.ly/pie vs barchart) 5

Avoid pie charts

B

B A

A C

C E

E D

D

via @MonaChalabi (bit.ly/pie vs barchart) 6

Avoid pie charts

B

B A

A C

C E

E D

D

20

20

15

15

10

10

5

5

0

0 A

B

C

D

E

A

B

C

D

E

via @MonaChalabi (bit.ly/pie vs barchart) 6

Avoid pie charts B

B A

A C C

E

E D

D

20

20

15

15

10

10

5

5

0

0 A

B

C

D

E

A

B

C

D

E

via @MonaChalabi (bit.ly/pie vs barchart) 6

Consider logs

7

Consider logs

7

Consider logs

7

Consider logs

8

Consider logs

8

Consider logs

8

Consider logs

8

Consider logs

8

Take differences

9

Ease comparisons

18

18

16

16 Phenotype

Phenotype

(things to be compared should be adjacent)

14

14

12

12

10

10

Female

Male

AA

Female

Male

AB

Female

Male

BB

AA

AB

BB

Female

AA

AB

BB

Male

10

Ease comparisons

18

18

16

16 Phenotype

Phenotype

(add a bit of color)

14

14

12

12

10

10

Female

Male

AA

Female

Male

AB

Female

Male

BB

AA

AB

BB

Female

AA

AB

BB

Male

11

Which comparison is easiest? 150

150

100

100

400

300

200

50

50 100 B A

0

0 A

B

0 A

400

B

400 B B

300

300

200

200

100

100

B

A 0

A

A

0

12

Don’t distort the quantities (value ∝ radius)

Wheat (17 Gbp)

Human (3.2 Gbp)

Arabidopsis (0.145 Gbp) 13

Don’t distort the quantities (value ∝ area)

Wheat (17 Gbp)

Human (3.2 Gbp)

Arabidopsis (0.145 Gbp) 14

Don’t use areas at all (value ∝ length)

Genome size (Gbp)

15

10

5

0 Arabidopsis

Human

Wheat 15

Encoding data

Quantities

Categories

• Position

• Shape

• Length

• Hue (which color)

• Angle

• Texture

• Area

• Width

• Luminance (light/dark) • Chroma (amount of color)

16

Ease comparisons (align things vertically) Women

55

60

65

Men

70

75

Height (in)

55

60

65

70

75

Height (in)

Men

55

60

65

70

75

Height (in)

17

Ease comparisons (use common axes) Women

55

60

60

Women

65

70

75

55

60

65

Height (in)

Height (in)

Men

Men

65

70 Height (in)

75

55

60

65

70

75

70

75

Height (in)

18

Use labels not legends

● ● ●

setosa versicolor virginica



2.5

● ● ● ●● ● ● ● ●● ● ● ● ●●● ●● ●● ●●●●

2.0 ●

Petal width (cm)

●●

● ● ●● ● ●

● ● ●

1.5

● ●● ● ●●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●●● ● ●● ● ● ● ● ● ●● ●

1.0







virginica

● ●

●● ●● ●●●●

2.0

● ● ● ● ●● ● ● ● ●

●● ● ● ●

versicolor

● ●● ● ●●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●●● ● ●● ● ● ●

● ● ●● ●

1.0



0.5

● ● ●● ● ●

● ● ●

1.5

●●

● ● ● ●● ● ● ● ●● ● ● ● ●●●



Petal width (cm)

2.5

● ●



● ●

● ● ● ● ●● ●

● ●

●● ● ● ●



0.5

● ●● ●● ● ●●●● ● ● ● ●● ●● ● ● ● ● ●● ● ●● ●● ● ●●●● ● ● ● ● ●●

● ●● ●● ● ●●●● ● ● ● ●● ●● ● ● ● ● ●● ● ●● ●● ● ●●●● ● ● ● ● ●●

0.0

setosa

0.0 1

2

3

4

5

Petal length (cm)

6

7

1

2

3

4

5

6

7

Petal length (cm) 19

Don’t sort alphabetically Argentina Australia Austria Belgium Brazil Canada China France Germany India Indonesia Italy Japan Korea, Rep. Mexico Netherlands Norway Poland Russian Federation Spain Sweden Switzerland Turkey United Kingdom United States

● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●

0

5

10

15

Health care spending (% GDP)

United States Netherlands France Canada Germany Switzerland Austria Belgium Italy Spain Sweden United Kingdom Japan Norway Australia Brazil Argentina Korea, Rep. Poland Turkey Russian Federation Mexico China India Indonesia

● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●

0

5

10

15

Health care spending (% GDP) 20

Must you include 0?

120 96.5%

98.1%

99.2%

99 Detection rate (%)

Detection rate (%)

100

100

80 60 40

98

97

96

20 0

95 A

B Method

C

A

B

C

Method 21

A bad table

22

Fewer digits

23

Yuck! 1990

2005

n

Rate (95% CI)

2010

n

Rate (95% CI)

p value

n

Rate (95% CI)

(Continued from previous page) Globally