/
Skill sharing: Combining base and ggplot2 graphics in R. Skill sharing: Combining base and ggplot2 graphics in R.

Skill sharing: Combining base and ggplot2 graphics in R. - PowerPoint Presentation

alexa-scheidler
alexa-scheidler . @alexa-scheidler
Follow
376 views
Uploaded On 2018-01-05

Skill sharing: Combining base and ggplot2 graphics in R. - PPT Presentation

GLEON Fellowship Workshop January 1418 2013 Sunapee NH Richard Iestyn Woolway Plotting with R R provides several frameworks for composing figures The simplest is the base graphics Another plotting system of R is ggplot2 which ID: 619736

base graphics plotting ggplot2 graphics base ggplot2 plotting par panel create gridbase figures ggplot figure plot acf quality grid

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Skill sharing: Combining base and ggplot..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Skill sharing: Combining base and ggplot2 graphics in R.

GLEON Fellowship Workshop

January 14-18, 2013

Sunapee, NH

Richard

Iestyn

WoolwaySlide2

Plotting with R

R provides several frameworks for composing figures.

The simplest is the base graphics.

Another plotting system of R is ggplot2, which allows users to create publishable figures with ease.Has a good book explaining the philosophy behind it:http://ggplot2.org/Slide3

I recently needed to create a multi panel figure composed of a line

plot, continuous wavelet transform, and

the autocorrelation of a

time series .This can easily be created in base graphics using either par() or layout().I then decided to use ggplot2 to improve the quality of the acf plot in the third panel of the figure.

Plotting with R – base graphicsSlide4

Plotting with R – ggplot2 graphics

We can improve the quality of the

acf

plot with ggplot2:However, as par() and layout() are only available with base graphics, we cannot mix base and ggplot graphics in a single figure window.The most appropriate solution is to use the gridBase package.

The script called ‘RIW_code.R’ shows how gridBase is used. Slide5

Integration of base and ggplot graphics

gridBase

provides similar functionality to par(

mfrow=c(x,y)).This is an useful technique when we wish to create multiple panel figures that combines plots based on base graphics (e.g. biplots), that have not been implemented in grid (i.e. ggplot), and the task of re-implementing in grid is extremely daunting.