Lecture 5 advanced multipanel plots

Slides:



Advertisements
Similar presentations
Lecture 5 advanced multipanel plots Trevor A. Branch Beautiful graphics in R, FISH554 SAFS, University of Washington.
Advertisements

Lecture 1: Beautiful graphics in R
6601 Project---Graphics --Enhancing Plots --Fine Control of Graphics Xingyan Bai, Qian Zhang, Ying Li.
FISH 397C Winter 2009 Evan Girvetz More Complex Graphics in R © R Foundation, from
1 Create a Questionnaire Learning Objective  To learn how to use the features in Microsoft Publisher to create a questionnaire.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 06: Tables - Spring 2011.
Pasewark & Pasewark 1 Word Lesson 6 Working with Graphics Microsoft Office 2007: Introductory.
Microsoft Office 2007: Introductory 1 Word Lesson 6 Working with Graphics Computer Applications 1.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. a lesson approach Microsoft® PowerPoint 2010 © 2011 The McGraw-Hill Companies,
Do Now.
McGraw-Hill Career Education© 2008 by the McGraw-Hill Companies, Inc. All Rights Reserved. 2-1 Office PowerPoint 2007 Lab 2 Modifying and Refining a Presentation.
PowerPoint: Working with Slides Lecture 7-2 CMPSC 100 Spring 2004 Penn State University Doug Hogan.
POWERPOINT REVIEW Computer Technology. After reading the definition, think of the answer. Then, click to reveal the answer and see if you are correct.
An Introduction to R graphics Cody Chiuzan Division of Biostatistics and Epidemiology Computing for Research I, 2012.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 22P. 1Winter Quarter MATLAB: Simultaneous Equations Lecture 22.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall. 1 Skills for Success with Microsoft ® Office 2007 PowerPoint Lecture to Accompany.
MSOffice PowerPoint 1 Part 2 ® Microsoft® Office 2010: Illustrated Introductory.
Review > head(tripData) > table(speciesData$SpeciesCode) > grep("a", c("aa","ab","bb")) > c(2,3,8) %in% c(1,2,3,5,7,9) > bocTrip
TABLES. Session Checklist ► Learn the ways that tables can help you organize data on your Web site ► Learn how to prepare a spreadsheet-like table that.
Excel 2007 ® Business and Personal Finances How can Excel 2007 help you format a workbook?
Course Area of Composite Figures 10-3 Area of Composite Figures Course 1 Warm Up Warm Up Lesson Presentation Lesson Presentation Problem of the.
Microsoft® PowerPoint  From the Insert tab, in the Tables group, click the Insert Table button.  Drag your pointer down and across to define.
© 2012 The McGraw-Hill Companies, Inc. All rights reserved. word 2010 Chapter 4 Working with Tables and Graphics.
How to use Microsoft PowerPoint
Creating a Presentation
THE INDUSTRIAL REVOLUTION Capitalism v. Socialism
Area of Composite Figures
Topic one text Topic two text Topic three text Topic four text
Trevor A. Branch Beautiful graphics in R, FISH554
From: Flow Fields Inside Stocked Fish Cages and the Near Environment
Lecture 10: creating animations in R
Picture with artistic effects and custom border (Advanced)
Inserting and Working with Images
Lecture 4: overplotting and multipanel plots
Space and size organization of receptive fields in the archer fish optic tectum. Space and size organization of receptive fields in the archer fish optic.
From: Estimating predictive stimulus features from psychophysical data: The decision image technique applied to human faces Journal of Vision. 2010;10(5):22.
From: A new analytical method for characterizing nonlinear visual processes with stimuli of arbitrary distribution: Theory and applications Journal of.
Microsoft® Office 2010: Illustrated Introductory
Word Lesson 6 Working with Graphics
What does learning look like?
Tables, Smart Art and Templates
Animated picture fades from gray to color (Basic)
Section F – Moral Decision Making
Add animated sparkles to a picture (Basic)
Smart Graphic Layout TOPIC statement
به نام مهربانترین In the name of the most compassionate
Topic one text Topic two text Topic three text Topic four text
РОСІЙСЬКА МОВА Кількість завдань - 51 Час на виконання – 150 хв.
Data Tables and Drawing Schemes
Texture Texture refers to the way something feels.
Animated picture with “video wall” reveal effect (Basic)
Fly-in marquee lights at picture entrance (Intermediate)
Literature Reading Group Project
Warm Up Problem of the Day Lesson Presentation Lesson Quizzes.
Template for Digital Display (Title)
Warm Up Problem of the Day Lesson Presentation Lesson Quizzes.
Coding of the Reach Vector in Parietal Area 5d
بودجه پیشنهادی سال 1398 شرکت توزیع نیروی برق استان تهران
Pictures in 3-D flip book (Intermediate)
Picture recolored and blurred with film grain effect (Advanced)
Empower Support Freedom Inspire Together
Critiquing Art Pictures series in film strip effect (Intermediate)
Smart Graphic Layout TOPIC statement
Using Word to Write the Story of Your Life
LPD Church of the Week We praise God for the smooth transition to two services and for the new faces we have seen as a result of increasing our capacity.
Title of presentation | Presentation by [Enter details in 'Header & Footer' field 18/05/2019.
TEXT FORMAT Textured and layered background with title - Advanced
Foundation Level Course
26 days to go Animated countdown timer on textured background
Day Dreaming Video Template
Presentation transcript:

Lecture 5 advanced multipanel plots Trevor A. Branch tbranch@uw.edu Beautiful graphics in R, FISH554 SAFS, University of Washington

Visualization courses at UW FISH 554 Beautiful Graphics in R (Branch, Winter https://canvas.uw.edu/courses/947334) INFO 424 Information Visualization and Aesthetics (Ostergren, Fall http://courses.washington.edu/info424/) INFX 598E Information Visualization for Information Professionals (Ostergren, summer https://canvas.uw.edu/courses/891359) HCDE 411 Information Visualization (Aragon, uses Tableau, http://faculty.washington.edu/aragon/classes/hcde411/w13/) HCDE 508 Visual Media (Ostergren, http://www.hcde.washington.edu/courses) HCDE 511 Information Visualization (Aragon, http://www.washington.edu/students/icd/S/hcde/511aragon.html) CSE 512 Information Visualization (Heer, for programmers, uses D3, HTML, R, etc. http://courses.cs.washington.edu/courses/cse512/14wi/) DESIGN 478 Information Design (Cheng, limited to Design students, http://www.washington.edu/students/crscat/design.html) HCDE=Human Centered Design & Engineering, INFO=Information School, CSE=Computer Science & Engineering, DESIGN=School of Art, division of Design

Five multipanel methods in base R Methods cannot be combined with each other par(mfrow) or par(mfcol) layout(mat, widths, heights) par(fig) par(plt) split.screen(figs)

par(mfrow) Every figure is the same size Source: Melissa Clarkson, http://students.washington.edu/mclarkso/

layout(mat) Figures must be placed on a grid system; widths and heights can be adjusted; figures can occupy more than one grid rectangle; squares can be left blank

mat <- matrix(c(1,2), nrow=1, ncol=2) layout(mat=mat, widths=c(56, 29)) Branch et al. (2011) Conservation Biology 25:777-786

maxC <- apply(reven.data, MARGIN=2,max) mat <- matrix(1:8,nrow=4,ncol=2, byrow=T) par(mar=c(0,2.5,0,0), oma=c(5,2.5,4,1)) layout(mat=mat, widths=c(30,16),heights=30+maxC)

layout(mat=mat, heights=c(1,1,1,1,1), widths=c(5,5,3,10)) mat=matrix(c(1,2,3,4,5, 6,7,8,9,10, 0,0,0,0,0, 11,11,11,11,11), nrow=5, ncol=4, byrow=T) layout(mat=mat, heights=c(1,1,1,1,1), widths=c(5,5,3,10)) par(oma=c(5,5,1,1),mar=c(0,0,0,0)) Worm et al. (2009) Science 325:578-585

Trickery for bottom-right “legend” Main plot mat <- matrix(c(1,2,3,3), nrow=2, ncol=2, byrow=F) par(oma=c(1,2,1,11), mar=c(3,2,0,1)) layout(mat=mat, widths=c(2,1.3), heights=c(2.2,1)) Trickery for bottom-right “legend” par(xpd=NA) positions <- seq(from=2025,to=2060,length.out=5) ypos <- c(-0.34,0.66) #then commands for rect(), #arrows, axis(at=,pos=), #etc. par(xpd=T) Branch et al. (2010) Nature 468:431-435

Source: Melissa Clarkson, http://students.washington.edu/mclarkso/

Source: Melissa Clarkson, http://students.washington.edu/mclarkso/

par(plt) Individual figures are added anywhere and of any size, one at a time. Each plot border is defined as a vector of four values (0 to 1) with positions (left, right, bottom, top) par(plt=c(0.4, 0.8, 0.2, 0.7)) Source: Melissa Clarkson, http://students.washington.edu/mclarkso/

par(fig) Individual figures are added anywhere and of any size, one at a time. Each figure border is defined as a vector of four values (0 to 1) with positions (left, right, bottom, top) par(fig=c(0.4, 0.8, 0.2, 0.7)) Source: Melissa Clarkson, http://students.washington.edu/mclarkso/

Using par(fig) and par(plt) Coordinates are given in normalized device space (from 0 to 1) and are specified by: c(left, right, bottom, top) a different order from par or oma 2. Plots can partially overlay other plots 3. Replacing fig= with plt= sets the plot border instead of the figure border Source: Melissa Clarkson, http://students.washington.edu/mclarkso/

Figures at arbitrary (non-grid) locations using fig par(fig=c(0.4,0.7,0.1,0.7)) plot(…) par(new=T) par(fig=c(0.1,0.3,0.05,0.65)) par(fig=c(0.2,0.8,0.75,0.9))

Figures at arbitrary locations using split.screen mat <- matrix(c(0.0, 0.1, 0.9, 1.0, 0.0, 0.3, 0.7, 1.0, 0.1, 0.6, 0.4, 1.0, 0.3, 1.0, 0.0, 0.7), nrow=4,ncol=4,byrow=T) par(mar=c(0,0,0,0), oma=c(1,1,1,1)) split.screen(figs=mat) for (i in 1:4) { screen(n=i, new=F) plot(…) } close.screen(all.screens=T) Each row in matrix is the outline of a plot from 0 to 1 specified by: c(left, right, bottom, top) a different order from par or oma

Figures at arbitrary locations using split.screen mat <- matrix(c(0.0, 0.1, 0.9, 1.0, 0.0, 0.3, 0.7, 1.0, 0.1, 0.6, 0.4, 1.0, 0.3, 1.0, 0.0, 0.7), nrow=4,ncol=4,byrow=T) par(mar=c(0,0,0,0), oma=c(1,1,1,1)) split.screen(figs=mat) for (i in 1:4) { screen(n=i, new=F) plot(…) } close.screen(all.screens=T) 1.0 0.9 0.7 0.4 0.0 0.0 0.1 0.3 0.6 1.0

Branch et al. (2010) Nature 468:431-435

Branch et al. (2010) Nature 468:431-435

Dean’s Visualization Prize The class project comprises four figures: three on your own data, one on Porzio et al. (2011) The best portfolio of figures will be awarded the Dean’s Visualization Prize by Lisa Graumlich, dean of the College of the Environment Judges: Lisa Graumlich, Trevor Branch, Marilyn Ostergren, Liz Neeley The prize is attendance at full-day seminar by Edward Tufte (includes copies of his books, more details here http://www.edwardtufte.com/tufte/courses), or a selection of visualization and R books

Class project: Figure 1 Fig. 2. Kite diagram showing the distribution of the most abundant macroalgal species (N3% coverage) in 27 20×20 cm quadrats taken along a pH gradient from S1 (pH=8.1), S2 (pH=7.8) and S3 (pH=6.7). R=Rhodophyta, O=Ochrophyta, and C=Chlorophyta. Porzio et al. (2011) Journal of Experimental Marine Biology and Ecology 400:278-287

Separate PowerPoint showing past class projects (not posted)

Exercise 1 Create this plot from the data in "CalCurrRevenue Exercise 1 Create this plot from the data in "CalCurrRevenue.csv" using layout(), par(fig) or par(plt), and split.screen() Fig. 5 Main plot plus subplots, example for ex. 1

Exercise 2 (advanced) Reproduce the xkcd cartoon Exercise 2 (advanced) Reproduce the xkcd cartoon. I suggest using par(fig) to solve this. Concentrate on doing the figures first, not on the text. http://xkcd.com/688/ First attempt in R