Top Banner
Some Possibly Useful Graphics Functions Lunch presentation
19

Some Possibly Useful Graphics Functions Lunch presentation.

Dec 24, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Some Possibly Useful Graphics Functions Lunch presentation.

Some Possibly Useful Graphics Functions

Lunch presentation

Page 2: Some Possibly Useful Graphics Functions Lunch presentation.

GGPlot2

• Hadley Wickham• Grammar Of Graphics• GGPlot2 Website• If I see it on the GGPlot2 page it might be

easier/better looking to use than using R plot function

Page 3: Some Possibly Useful Graphics Functions Lunch presentation.

Syntax

• What I’m used to:– Plot(x,y, col=whatever, main=whatever)

– Legend(…)

– par(mfrow=c(1,2))

Page 4: Some Possibly Useful Graphics Functions Lunch presentation.

Syntax

• What I’m used to:– Plot(x,y, col=whatever, main=whatever) ggplot(dataFrame,aes(x,y,sometimes z) +

the name of the plot you want +– Legend(…) + options like labels/colors/text/lines– par(mfrow=c(x,y))grid.newpage()pushViewport(viewport(layout = grid.layout(x, y)))viewport(layout.pos.row = x, layout.pos.col = y)

Page 5: Some Possibly Useful Graphics Functions Lunch presentation.

How Might it be Useful

1) Do you have your data in a data.frame?2) Are you ok with acceding control of the

details?3) Do you anticipate summarizing your data by

one or more variables in your data frame?4) Do you see your plot or something like it on

Hadley’s page?

Page 6: Some Possibly Useful Graphics Functions Lunch presentation.

R Plot Function

Page 7: Some Possibly Useful Graphics Functions Lunch presentation.

R Plot Function Again

Page 8: Some Possibly Useful Graphics Functions Lunch presentation.

R Barplot Function

Page 9: Some Possibly Useful Graphics Functions Lunch presentation.

geom_bar

Page 10: Some Possibly Useful Graphics Functions Lunch presentation.

Specify Factor Levels

Page 11: Some Possibly Useful Graphics Functions Lunch presentation.

Specify Arbitrary Factor Levels

Page 12: Some Possibly Useful Graphics Functions Lunch presentation.

geom_point

Page 13: Some Possibly Useful Graphics Functions Lunch presentation.

Remove Background Grid

Page 14: Some Possibly Useful Graphics Functions Lunch presentation.

Specify Colors

Page 15: Some Possibly Useful Graphics Functions Lunch presentation.

Change legend label

Page 16: Some Possibly Useful Graphics Functions Lunch presentation.

Change title and axes labels

Page 17: Some Possibly Useful Graphics Functions Lunch presentation.

geom_point

Page 18: Some Possibly Useful Graphics Functions Lunch presentation.

Facet by sample

Page 19: Some Possibly Useful Graphics Functions Lunch presentation.

Flip it