GGPLOT-March 2015x

Download Report

Transcript GGPLOT-March 2015x

Enhanced Graphics Using
GGPLOT2 in R
Paul Sabin
March 23rd & 24th, 2015
S
About the Author
 Graduate Student
 BS, MS in Statistics, BYU
 BA in French, BYU
 LISA Collaborator
 Sports Enthousiast
About
Laboratory for Interdisciplinary Statistical Analysis
S
Free Collaboration
S
S
S
Experimental Design, Data Analysis, Software Help, Interpreting Results, Grant Proposals
Free Walk-In Consulting for quick statistics questions
S
M-F 1-3 PM in 103 OSB
S
T,Th,F 10-Noon in GLC
S
W 10-Noon in 403-J Hutcheson Hall
Free Short Courses
S
R tutorial; Structural Equation Modeling; Plotting Data
Requesting a LISA Meeting
S Go to www.lisa.stat.vt.edu
S Click link for “Collaboration Request Form”
S Sign into the website using VT PID and password
S Enter your information
S Email, college, etc.
S Describe your project (project title, research goals, specific research questions, if
you have already collected data, special requests, etc.)
S Contact assigned LISA collaborators as soon as possible to schedule a
meeting
Course Outline
S QPLOT() Function
S Layer Based Graphics
S Pros and Cons of GGPLOT
Purpose of GGPLOT
GGPLOT was created to make building plots in R easier.
It uses the science of aesthetics to easily make plots that are
much more aesthetically pleasing to the eye.
QPLOT()
The qplot() function in the GGPLOT2 package is made to work
similarly to the plot() function in R.
Code
Layer Based Graphics
S GGPLOT uses “layers” to build graphics
S Drug in medical experiment
S Settings on machine producing tires
S Different types of political advertising to encourage voting
S Think of it as a linear equation to building plots
S First, tell it where the data come from
S Second, tell it what kind of graph you want and how to group the data
S Third, customize the graphs other features (Title, axis, etc.)
Pros & Cons of GGPLOT
S Hard to customize certain features
S Background grey
S Grouping colors
S Pro: The grouped colors will never look bad, just aren’t always
customized.