An Introduction to ggplot2
[Pages:48]An Introduction to ggplot2
Laurel Stell May 1, 2019
Introduction
To run the examples yourself
1 2 Links at bottom of page to R Markdown file and slides May also need to install the following packages: library(ggplot2) library(gridExtra) library(plyr) library(reshape2)
Objectives
How to make some common types of plots with ggplot2 Demonstrate the paradigm for advanced customizations Tips on learning more
Prerequisites
Basic knowledge of R: Factors, data frames, etc Installing and loading packages Base graphics functions such as plot
Note: ggplot2 is based on grid package. Do not mix with base graphics such as par(), split.screen(), axis(), legend().
First Steps
The paradigm
ggplot2 is part of tidyverse by Hadley Wickham Syntax is based on The Grammar of Graphics by Leland Wilkinson
$140 new on Amazon Available online for Stanford affiliates at . com/lib/stanford-ebooks/detail.action?docID=302755 But I've never looked at this book. Basically, build sentences: Call ggplot() to specify data Add "layers" with geom_point(), geom_histogram(), etc Add customizations
Example: simple scatter plot
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy))
hwy
40 30 20
2
3
4
5
6
7
displ
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- an introduction to marketing pdf
- an introduction to moral philosophy
- an introduction to business
- an introduction to r pdf
- an introduction to an essay
- an introduction to linguistics
- an introduction to formal logic
- an introduction to information retrieval
- an introduction to hazardous materials
- an introduction to literature pdf
- an introduction to community development
- chapter 8 an introduction to metabolism key