Multipanel plotting in R with base graphics Sean Anderson Nov - - PowerPoint PPT Presentation

multipanel plotting in r
SMART_READER_LITE
LIVE PREVIEW

Multipanel plotting in R with base graphics Sean Anderson Nov - - PowerPoint PPT Presentation

Multipanel plotting in R with base graphics Sean Anderson Nov 2011 scanders@sfu.ca Compared to what? - Tufte by hand ggplot2 lattice par(mfrow) layout() split.screen() par(mfrow) par(mfrow) John et al. 1988, Science, 239, p162 and


slide-1
SLIDE 1

Multipanel plotting in R

with base graphics

Sean Anderson Nov 2011 scanders@sfu.ca

slide-2
SLIDE 2

Compared to what?

  • Tufte
slide-3
SLIDE 3

by hand ggplot2 lattice

slide-4
SLIDE 4

par(mfrow) layout() split.screen()

slide-5
SLIDE 5

par(mfrow)

slide-6
SLIDE 6 John et al. 1988, Science, 239, p162 and reprinted in Tufte, Envisioning Information, p78

par(mfrow)

slide-7
SLIDE 7 ฀฀฀฀฀฀฀฀ ฀ ฀ gure 1. Beanplots of potential correlates of extinction risk for five groups of vertebrate species in Canada. The short vertical lines Anderson et al. 2011, Bioscience, 61, p538

par(mfrow)

slide-8
SLIDE 8
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x

log(mean) log(variance)

Anderson et al. In Prep.

par(mfrow)

slide-9
SLIDE 9

layout()

slide-10
SLIDE 10 Year that recent fishery began Time to peak (years) Australia Egypt Fiji Indonesia Madagascar Malaysia Maldives M e x i c
  • New Caledonia
Papua New Guinea Philippines Republic of Korea Seychelles Solomon Islands Tanzania USA − California USA − Washington State (a) 1950 1960 1970 1980 1990 2000 10 20 30 40 50 60 Distance from Hong Kong (km) Australia Canada − East Canada − West Chile Egypt Fiji Indonesia Japan Madagascar Malaysia Maldives Mexico New Caledonia Papua New Guinea Philippines Republic of Korea Solomon Islands Sri Lanka Tanzania US − Alaska USA − California USA − Maine USA − Washington State (b) 1950 1960 1970 1980 1990 2000 5000 10000 15000 20000 (c) 1960 1970 1980 1990 2000 Year that recent fishery began 1950 Anderson et al. 2011, Fish. Fish, 12, p317

layout()

slide-11
SLIDE 11 Year that recent fishery began Time to peak (years) Australia Egypt Fiji Indonesia Madagascar Malaysia Maldives M e x i c
  • New Caledonia
Papua New Guinea Philippines Republic of Korea Seychelles Solomon Islands Tanzania USA − California USA − Washington State (a) 1950 1960 1970 1980 1990 2000 10 20 30 40 50 60 Distance from Hong Kong (km) Australia Canada − East Canada − West Chile Egypt Fiji Indonesia Japan Madagascar Malaysia Maldives Mexico New Caledonia Papua New Guinea Philippines Republic of Korea Solomon Islands Sri Lanka Tanzania US − Alaska USA − California USA − Maine USA − Washington State (b) 1950 1960 1970 1980 1990 2000 5000 10000 15000 20000 (c) 1960 1970 1980 1990 2000 Year that recent fishery began 1950 Anderson et al. 2011, Fish. Fish, 12, p317

1 2 3

layout()

slide-12
SLIDE 12 500 1000 1500 Eastern Newfoundland SPA (1000 t) Cod 5 10 15 Commercial CPUE (kg/trap) Crab −1.0 −0.5 0.0 1970 1980 1990 2000 2010 TemperatureC 100 200 300 400 Southern Gulf of St. Lawrence SPA (1000 t) 20 40 60 Commercial CPUE (kg/trap) 0.0 0.5 1.0 1.5 1970 1980 1990 2000 2010 500 1000 1500 Northern Newfoundland SPA (1000 t) 5 10 15 Commercial CPUE (kg/trap) 0.0 1.0 2.0 1970 1980 1990 2000 2010 5 10 15 20 25 Western Cape Breton RS (1000 t) 20 40 60 80 Commercial CPUE (kg/trap) 0.5 1.5 2.5 1970 1980 1990 2000 2010 100 200 300 400 Northern Gulf of St. Lawrence SPA (1000 t) 5 10 20 Commercial CPUE (kg/trap) 1.0 1.5 2.0 2.5 1970 1980 1990 2000 2010 50000 150000 Eastern Scotian Shelf SPA (1000 t) Cod 20 60 100 Commercial CPUE (kg/trap) Crab 1.5 2.5 3.5 1970 1980 1990 2000 2010 TemperatureC 10 20 30 40 Northern Cape Breton RS/SPA (1000 t) 20 40 60 80 Commercial CPUE (kg/trap) 2.0 2.5 3.0 3.5 1970 1980 1990 2000 2010 0.0 1.0 2.0 3.0 Southern Newfoundland RS (Biomass index) 5 10 15 Commercial CPUE (kg/trap) 2 3 4 5 6 1970 1980 1990 2000 2010 10 20 30 40 Gulf of Maine SPA (1000 t) 0.000 0.004 0.008 RS (kg/trap) 4.5 5.5 6.5 1970 1980 1990 2000 2010 10 20 30 40 Flemish Cap SPA (1000 t) 50 100 150 RS (t) 6 7 8 9 11 1970 1980 1990 2000 2010 Year Boudreau et al. 2011, MEPS, 429, p169

layout()

slide-13
SLIDE 13 500 1000 1500 Eastern Newfoundland SPA (1000 t) Cod 5 10 15 Commercial CPUE (kg/trap) Crab −1.0 −0.5 0.0 1970 1980 1990 2000 2010 TemperatureC 100 200 300 400 Southern Gulf of St. Lawrence SPA (1000 t) 20 40 60 Commercial CPUE (kg/trap) 0.0 0.5 1.0 1.5 1970 1980 1990 2000 2010 500 1000 1500 Northern Newfoundland SPA (1000 t) 5 10 15 Commercial CPUE (kg/trap) 0.0 1.0 2.0 1970 1980 1990 2000 2010 5 10 15 20 25 Western Cape Breton RS (1000 t) 20 40 60 80 Commercial CPUE (kg/trap) 0.5 1.5 2.5 1970 1980 1990 2000 2010 100 200 300 400 Northern Gulf of St. Lawrence SPA (1000 t) 5 10 20 Commercial CPUE (kg/trap) 1.0 1.5 2.0 2.5 1970 1980 1990 2000 2010 50000 150000 Eastern Scotian Shelf SPA (1000 t) Cod 20 60 100 Commercial CPUE (kg/trap) Crab 1.5 2.5 3.5 1970 1980 1990 2000 2010 TemperatureC 10 20 30 40 Northern Cape Breton RS/SPA (1000 t) 20 40 60 80 Commercial CPUE (kg/trap) 2.0 2.5 3.0 3.5 1970 1980 1990 2000 2010 0.0 1.0 2.0 3.0 Southern Newfoundland RS (Biomass index) 5 10 15 Commercial CPUE (kg/trap) 2 3 4 5 6 1970 1980 1990 2000 2010 10 20 30 40 Gulf of Maine SPA (1000 t) 0.000 0.004 0.008 RS (kg/trap) 4.5 5.5 6.5 1970 1980 1990 2000 2010 10 20 30 40 Flemish Cap SPA (1000 t) 50 100 150 RS (t) 6 7 8 9 11 1970 1980 1990 2000 2010 Year Boudreau et al. 2011, MEPS, 429, p169

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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

layout()

slide-14
SLIDE 14

split.screen()

slide-15
SLIDE 15 Taylor et al. 1982, J. Anim. Ecol., 51, p879

split.screen()

slide-16
SLIDE 16 20 40 60 80 100 (a) Original Percentage of fisheries (b) Original static method Year 1960 1970 1960 1970 1980 (d) Revised robust−dynamic method Collapsed Overexploited Fully exploited Developing
  • r closed
1990 2000 (c) Revised 20 40 60 80 100 Anderson et al. In Review

split.screen()

slide-17
SLIDE 17 3.5 4.0 1 2 a Eastern Bering Sea 3.0 3.5 4.0 3 4 5 b Gulf of Alaska 3.0 3.5 4.0 6 c California Current 2.5 3.0 3.5 7 8 d Gulf of Mexico 1950 1965 1980 1995 2.5 3.0 3.5 4.0 e Southeast USA 2.5 3.0 3.5 4.0 4.5 9 10 11 12 13 f Northeast USA 3.0 3.5 4.0 14 15 g Scotian Shelf 3.0 3.5 4.0 4.5 16 1718 h Newfoundland−Labrador 3.5 4.0 19 20 21 i North Sea 1950 1965 1980 1995 3.5 4.0 22 23 j Celtic−Biscay 3.5 4.0 24 k Canary Current 3.0 3.5 4.0 4.5 25 l Benguela Current 3.0 3.5 26 mGulf of Thailand 3.0 3.5 4.0 27 n Northwest Australia 3.5 4.0
  • Southeast Australia
1950 1965 1980 1995 3.5 4.0 4.5 28 29 p New Zealand Year Mean trophic level Branch et al. 2010, Nature, 468, p431

split.screen()

slide-18
SLIDE 18

r = −0.1 0.5 1.5 a r = 0 b r = 0.1 k = 2 c 0.5 1.5 d e k = 16 f r = −0.5 0.5 1.0 g r = 0 h r = 0.5 µ2 µ1 = 1 i 0.5 1.0 1.0 1.5 2.0 2.5 j 1.0 1.5 2.0 2.5 k µ2 µ1 = 16 1.0 1.5 2.0 2.5 l Taylor's power law z−value Portfolio effect

Anderson et al. In Prep.

split.screen()

slide-19
SLIDE 19

split.screen()

0, 0.46 1, 0.46 1, 0.44 0.75, 0.44 0.75, 0 1, 0 0.72, 0 0.37, 0 0.37, 0.44 0.72, 0.44 0.35, 0.44 0.34, 0 0, 0.43 0, 0 1, 1 0, 1

slide-20
SLIDE 20 http://xkcd.com/323/

0, 0.46 1, 0.46 1, 0.44 0.75, 0.44 0.75, 0 1, 0 0.72, 0 0.37, 0 0.37, 0.44 0.72, 0.44 0.35, 0.44 0.34, 0 0, 0.43 0, 0 1, 1 0, 1

split.screen()

slide-21
SLIDE 21 http://xkcd.com/323/

split.screen()

slide-22
SLIDE 22