An Introduction to R graphics Cody Chiuzan Division of Biostatistics and Epidemiology Computing for Research I, 2012.

Slides:



Advertisements
Similar presentations
Lab # 03- SS Basic Graphic Commands. Lab Objectives: To understand M-files principle. To plot multiple plots on a single graph. To use different parameters.
Advertisements

Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
Plotting Selim Aksoy Bilkent University Department of Computer Engineering
Lecture (4) Plotting & Programming (1) Eng. Osama Talaat 1.
2D Plots 1 ENGR 1181 MATLAB 12.
Introduction to R Graphics
Introduction to Graphing Using MATLAB. Line Graphs  Useful for graphing functions  Useful for displaying data trends over time  Useful for showing.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
BCIS IB (Test 2) Excel Lessons 4 – 8 Press space bar to Advance Frame.
Graphics in R data analysis and visualization Katia Oleinik Scientific Computing and Visualization Boston University
Jeopardy Multiple Choice Fill in the Blank Modified T/F Vocabulary Positioning of data Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400.
Fundamental Features of Graphs All graphs have two, clearly-labeled axes that are drawn at a right angle. –The horizontal axis is the abscissa, or X-axis.
MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
Plotting Systems in R Dr. Jieh-Shan George YEH
Customizing Graphs Base graphics options. plot() The workhorse plotting function plot(x) plots values of x in sequence or a barplot plot(x, y) produces.
Graphics in MATLAB Week 15 – 5/5/09 Kate Musgrave
Evan Girvetz Winkenwerder Introduction to Graphics in R © R Foundation, from
A Simple Guide to Using SPSS© for Windows
FISH 397C Winter 2009 Evan Girvetz More Complex Graphics in R © R Foundation, from
Tutorial 8 Designing a Web Site with Frames. XP Objectives Explore the uses of frames in a Web site Create a frameset consisting of rows and columns of.
MATLAB Week 3 17 November Outline Graphics – Basic plotting – Editing plots from GUI – Editing plots from m-file – Advanced plotting commands.
Chapter 7: Creating Database Reports
Layouts: Creating maps and figures using ArcMap 1 GIS for Planetary Mappers June 2012, Planetary Mappers Meeting.
An introduction to Plotting in MATLAB Rikard Johansson Department of Biomedical Engineering (IMT) Linköping University
Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week5: Charts/Plots in R.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
An Introduction to R graphics Elizabeth Garrett-Mayer Slides borrowed from Cody Chiuzan & Delia Voronca March 24, 2014.
AN INTRODUCTION TO GRAPHICS IN R. Today Overview Overview –Gallery of R Graph examples High-Level Plotting Functions High-Level Plotting Functions Low-Level.
Graphics in R. X
R-Graphics Day 2 Stephen Opiyo. Basic Graphs One of the main reasons data analysts turn to R is for its strong graphic capabilities. R generates publication-ready.
Tutorial 8 Designing a Web Site with Frames. XP Objectives Explore the uses of frames in a Web site Create a frameset consisting of rows and columns of.
Chapter 5: Charts Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Developed By Information Technology Services University Of Saskatchewan.
Tutorial 8 Designing a Web Site with Frames. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore the uses of frames.
Histo-Labels Easy to use and fun to setup. Create and edit all label menus to fulfill your slide labeling requirements. Print to any printer installed.
Developed By Information Technology Services University Of Saskatchewan.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
Return to Outline Copyright © 2011 by Maribeth H. Price 3-1 Labeling and annotation.
R-Graphics Stephen Opiyo. Basic Graphs One of the main reasons data analysts turn to R is for its strong graphic capabilities. R generates publication-ready.
PROC GPLOT GPLOT is used to make two dimensional scatter-plots. General Syntax: proc gplot data=data-set options; plot y-variable*x-variable/options; run;
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
R (3) Introduction to Graphics. The main guide R in Action Data Analysis and Graphics with R Robert I. Kabacoff
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Plotting Complex Figures Using R
Matlab Introduction  Getting Around Matlab  Matrix Operations  Drawing Graphs  Calculating Statistics  (How to read data)
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
1 Excel Lesson 5 Working with Multiple Worksheets and Charts Microsoft Office 2010 Introductory Pasewark & Pasewark.
Positioning Objects with CSS and Tables
More points Multiple figures par(mfcol=c(3,2) par (mfrow)=c(3,2)
Introduction to plotting data Fish 552: Lecture 4.
Charts MOAC Lesson 6.
EGR 106 – Week 5 – 2-D Plots Question : Why do engineers use plots? Answer : To analyze, visualize, and present data. Matlab has many useful plotting options.
Review > mean(humidity, na.rm=T) > humidity[!is.na(humidity)] > X x Y Y[[1]][2,3] > zone.fac
How to use MATLAB (using M-files) Double click this icon To start Matlab 6.5.
Statistical Programming Using the R Language Lecture 2 Basic Concepts II Darren J. Fitzpatrick, Ph.D April 2016.
How to use Microsoft PowerPoint
Introduction to HTML.
Using R Graphs in R.
Lecture 25.
Professional Template for a poster presentation
Two-Dimensional Plots
Cartography and Labeling
Trevor A. Branch FISH 552 Introduction to R
Introduction to Exploratory Descriptive Data Analysis in S-Plus II
MATLAB How to use (using M-files) Double click this icon
MATLAB How to use (using M-files) Double click this icon
PLACE YOUR TITLE HERE **Poster Author(s) Go Here
MATLAB How to use (using M-files)
Introduction to R plot Instructor: Li, Han
Lesson 13 Working with Tables
Presentation transcript:

An Introduction to R graphics Cody Chiuzan Division of Biostatistics and Epidemiology Computing for Research I, 2012

R graphics – Nice and Simple R has powerful graphics facilities for the production of publication-quality diagrams and plots. Can produce traditional plots as well as grid graphics. Great reference: Murrell P., R Graphics

Topics for today Histograms Plot, points, lines, legend, xlab, ylab, main, xlim, ylim, pch, lty, lwd. Scatterplot matrix Individual profiles 3D graphs

Data Puromycin – Before and After

R code Data available in R; for a full description: help(Puromycin). We will start with the basic command plot() and tackle each parameter. Generate multiple graphs in the same window using: par(mfrow). For a better understanding use help().

Change parameters using par() A list of graphical parameters that define the default behavior of all plot functions. Just like other R objects, par elements are similarly modifiable, with slightly different syntax. e.g. par(“bg”=“lightcyan”) This would change the background color of all subsequent plots to light cyan When par elements are modified directly (as above, this changes all subsequent plotting behavior.

Par examples modifiable from within plotting functions bg – plot background color lty – line type (e.g. dot, dash, solid) lwd – line width col – color cex – text size inside plot xlab, ylab – axes labels main – title pch – plotting symbol … and many more (learn as you need them)

Plotting symbols for pch Great website for choosing colors: institute.org/efg/R/Color/Chart/Color Chart.pdf

Multiple plots The number of plots on a page, and their placement on the page, can be controlled using par() or layout(). The number of figure regions can be controlled using mfrow and mfcol. e.g. par(mfrow=c(3,2)) # Creates 6 figures arranged in 3 rows and 2 columns Layout() allows the creation of multiple figure regions of unequal sizes. e.g. layout(matrix(c(1,2)), heights=c(2,1))

Graph using statistical function output Many statistical functions (regression, cluster analysis) create special objects. These arguments will automatically format graphical output in a specific way. e.g. Produce diagnostic plots from a linear model analysis (see R code) # Reg = lm() # plot(Reg) hclust() agnes() # hierarchical cluster analysis

Save the output Specify destination of graphics output or simply right click and copy Could be files Not Scalable JPG # not recommended, introduces blurry artifacts around the lines BMP PNG Scalable: Postscript # preferred in LaTex Pdf # great for posters

Save the output setwd("") # this is where the plot will be saved pdf(file="Puromycin.pdf“, width =, height =, res = ) dev.off()

Next - 3D graphs