Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
### Title: Back to basics: High quality plots using base R graphics
### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015
###
### Date created: 20150418
### Last updated: 20150423
###
### Author: Michael Koontz
### Email: mikoontz@gmail.com
### Twitter: @michaeljkoontz
###
### Purpose: Introduce basic to intermediate plotting capabilities of base R graphics
###
### Basic methods
### 1) Basic scatterplot and labeling a plot (Line 44)
### 2) Plotting groups in different ways on the same plot (Line 72)
### 3) Adding a legend (Line 120)
### 4) Adding a best fit line (Line 150)
### 5) Adding a 95% confidence interval (Line 150)
### 6) Shaded confidence intervals (Line 223)
### 7) Bar plots (Line 260)
### 8) Error bars (Line 274)
###
### Intermediate methods
### 1) Using other graphics devices like pdf() (Line 324)
### 2) Using par() for multipanel plots (Line 380)
### 3) Using par() for margin adjustments (Line 438)
### 4) Using axis() and mtext() (Line 484)
### 5) Pretty print from plotmath (Line 601)
# We'll start with the very tractable 'trees' dataset, which is built into R. It describes the girth, height, and volume of 31 black cherry trees.
trees
dim(trees)
head(trees)
# Remember how we access the columns of a data.frame:
trees$Girth
trees$Volume
#Basic plot function takes x argument and a y argument
#Default plot type is points, but you can change it to lines or both points and lines by adding the 'type' argument
plot(x=trees$Girth, y=trees$Volume)
plot(x=trees$Girth, y=trees$Volume, type="l")
plot(x=trees$Girth, y=trees$Volume, type="b")
# pch: 'plotting character' changes the type of point that is used (default is an open circle); remember pch=19!
plot(x=trees$Girth, y=trees$Volume, pch=19)
# main: adds a title
plot(x=trees$Girth, y=trees$Volume, pch=19, main="Girth vs. Volume for Black Cherry Trees")
# xlab: adds an x axis label
plot(x=trees$Girth, y=trees$Volume, pch=19, main="Girth vs. Volume for Black Cherry Trees", xlab="Tree Girth (in)")
# ylab: adds a y axis label
plot(x=trees$Girth, y=trees$Volume, pch=19, main="Girth vs. Volume for Black Cherry Trees", xlab="Tree Girth (in)", ylab="Tree Volume (cu ft)")
# las: rotates axis labels; las=1 makes them all parallel to reading direction
plot(x=trees$Girth, y=trees$Volume, pch=19, main="Girth vs. Volume for Black Cherry Trees", xlab="Tree Girth (in)", ylab="Tree Volume (cu ft)", las=1)
# col: select a color for the plotting characters
plot(x=trees$Girth, y=trees$Volume, pch=19, main="Girth vs. Volume for Black Cherry Trees", xlab="Tree Girth (in)", ylab="Tree Volume (cu ft)", las=1, col="blue")
# We can use the c() function to make a vector and have several colors, plotting characters, etc. per plot.
plot(x=trees$Girth, y=trees$Volume, pch=19, main="Girth vs. Volume for Black Cherry Trees", xlab="Tree Girth (in)", ylab="Tree Volume (cu ft)", las=1, col=c("black", "blue"))
plot(x=trees$Girth, y=trees$Volume, pch=c(1,19), main="Girth vs. Volume for Black Cherry Trees", xlab="Tree Girth (in)", ylab="Tree Volume (cu ft)", las=1, col="blue")
#------------
# Plotting by group
#------------
### Those different colors and plotting characters that we just saw were arbitrary. The 2-element vector of colors or plotting characters just repeats for the whole data frame. What if we want to have more meaningful coloration, with a different color for each group?
### We'll use the iris dataset to illustrate one way to do this. This dataframe describes the sepal length, sepal width, petal length, petal width, and species for 150 different irises.
# First look at the data:
iris
head(iris)
dim(iris)
str(iris)
# We can extend the idea of passing a vector of colors to the col= argument in the plot() function call.
# Let's cheat first, and see what the finished product will look like. First I define a new object with the three colors that I want to use.
plot.colors <- c("violet", "purple", "blue")
plot.colors
# Here's the cheating bit: I just looked at this dataframe and saw that there are exactly 50 observations for each species.
iris
# I use the repeat function, rep() and the each= argument, to create a new vector with each element of plot.colors repeated 50 times in turn.
color.vector <- rep(x=plot.colors, each=50)
color.vector
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, col=color.vector)
# Notice the lengths of the x-vector, the y-vector, and the color vector are all the same.
length(iris$Petal.Length)
length(iris$Sepal.Length)
length(color.vector)
# What if we want to automate the process? We can take advantage of the fact that the Species column is a factor.
head(iris)
iris$Species
str(iris)
as.numeric(iris$Species)
plot.colors <- c("violet", "purple", "blue")
color.vector <- plot.colors[iris$Species]
dev.off() # Just clearing the present plots
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, col=color.vector, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", las=1)
#-----------
# Let's add a legend
#-----------
# We use the legend() function to add a legend to an existing plot
legend("topleft", pch=19, col=plot.colors, legend=unique(iris$Species))
# You can customize the legend if you wish.
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, col=color.vector, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", las=1)
# Here I pass a character vector to the legend= argument so that I can include the first letter of the species name
# The bty="n" argument suppresses the border around the legend. (A personal preference)
legend("topleft", pch=19, col=plot.colors, legend=c("I. setosa", "I. versicolor", "I. virginica"), bty="n")
# Italicize the labels in the legend using text.font=3
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, col=color.vector, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", las=1)
legend("topleft", pch=19, col=plot.colors, legend=c("I. setosa", "I. versicolor", "I. virginica"), bty="n", text.font=3)
#------------------
# Test yourself.
#------------------
#Using the ToothGrowth dataset built into R, plot the tooth length (the len column) as a function of the vitamin C dosage (the dose column). Use a different color for each method of administering the vitamin C (the supp column).
head(ToothGrowth)
#------------------
# Add a linear best fit line and confidence interval to a plot
#------------------
# We'll use a simple linear regression for this, but the general recipe is the same every time.
# The Recipe
# 1) Estimate the parameters of the best fit line
# 2) Make up your own x values that span the range of your data
# 3) Get your y values by applying your mathematical model (e.g. a straight line) with the best fit parameters to your fabricated x values
# 4) Plot these new y values against your fabricated x values.
# Save your model fit to an object. Here, we model Sepal.Length as a function of Petal.Length
model1 <- lm(Sepal.Length ~ Petal.Length, data=iris)
# Now we have the parameter estimates for our y=ax+b line. The estimate for (Intercept) is b, and the estimate for Petal.Length is a.
summary(model1)
# Make up our own x values; put them in a dataframe!
range(iris$Petal.Length)
xvals <- seq(from=1, to=7, by=0.1)
xvals
df <- data.frame(Petal.Length=xvals)
df
# Take advantage of the predict() function, which returns a matrix with one row for each of your new x values, and 3 columns: 'fit' is the expected y value, 'lwr' is the lower 95% confidence interval, and 'upr' is the upper 95% confidence interval. Note this only works this seamlessly using the predict() function on an lm() model
CI <- predict(model1, newdata=df, interval="confidence")
CI <- as.data.frame(CI) # Coerce the matrix to a dataframe, so we can access the column using the $ operator.
dim(df) # 61 x-values
head(df) # Here are the first 6 of them
dim(CI) # 61 records, 3 columns
head(CI) # y-values, lower 95% CI bounds, and upper 95% CI bounds
# Plot the actual data (in the iris dataframe)
# This code copied from above
plot.colors <- c("violet", "purple", "blue")
color.vector <- plot.colors[iris$Species]
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector)
# Plot our best fit line. The x values are the Petal.Length column from the 'df' dataframe, and the y values are the 'fit' column from the CI dataframe.
# Note that I use the lines() function, which just adds features to an existing plot.
# The lwd= argument changes the line width
lines(x=df$Petal.Length, y=CI$fit, lwd=2)
# Plot the confidence intervals
# The lty= argument changes the line type. There are 6 different line types, and you can just put a number 1 through 6 if you'd like. Default is "solid" (aka 1)
lines(x=df$Petal.Length, y=CI$lwr, lwd=2, lty="dashed", col="red")
lines(x=df$Petal.Length, y=CI$upr, lwd=2, lty="dashed", col="red")
#----------------------
# Going further... Prediction/forecast intervals
#----------------------
forecast <- predict(model1, newdata=df, interval="prediction")
forecast <- as.data.frame(forecast)
head(forecast)
# Plot the actual data (in the iris dataframe)
# This code copied from above
plot.colors <- c("violet", "purple", "blue")
color.vector <- plot.colors[iris$Species]
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector)
# New code using the forecast object
lines(x=df$Petal.Length, y=forecast$fit, lwd=2)
lines(x=df$Petal.Length, y=forecast$lwr, lwd=2, col="red", lty="dashed")
lines(x=df$Petal.Length, y=forecast$upr, lwd=2, col="red", lty="dashed")
#-------------
# Shaded region of forecast interval
#-------------
# This plot() call is copied from above
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector)
lines(x=df$Petal.Length, y=forecast$fit, lwd=2)
# New code
polygon.x <- c(df$Petal.Length, rev(df$Petal.Length))
polygon.y <- c(forecast$lwr, rev(forecast$upr))
# By default, R won't fill in the polygon
polygon(x=polygon.x, y=polygon.y)
# But we also may not want an opaque polygon
polygon(x=polygon.x, y=polygon.y, col='darkgrey')
# The adjustcolor() function is nice for 'turning down' the opacity. It takes a color and the opacity level as arguments. I also use border=NA to suppress the border of the polygon
# First recreate the plot
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector)
lines(x=df$Petal.Length, y=forecast$fit, lwd=2)
polygon(x=polygon.x, y=polygon.y, col=adjustcolor("black", alpha.f=0.4), border=NA)
# Add our legend back in
legend("topleft", pch=19, col=plot.colors, legend=c("I. setosa", "I. versicolor", "I. virginica"), bty="n", text.font=3)
#--------------
# Test yourself.
#--------------
# Layer the 95% confidence interval as a shaded region on top of the iris data, the best fit line for a Sepal.Length~Petal.Length model, and the forecast interval.
#------------
# Barplots
#------------
model2 <- lm(Sepal.Length ~ Species, data=iris)
bar.heights <- predict(model2, newdata=data.frame(Species=c("setosa", "versicolor", "virginica")))
# The basic barplot function
barplot(bar.heights)
# Let's add some flair
barplot(bar.heights, names.arg=c("I. setosa", "I. versicolor", "I. virginica"), las=1, col=adjustcolor(plot.colors, alpha.f=0.5), main="Sepal length for 3 Irises", ylab="Sepal length (cm)")
#---------------
# Error bars
#---------------
# Adding error bars to our barplot. These can be added to scatter plots in a similar way.
# We'll plot error bars representing 5 standard errors so you can see them more easily.
d <- summary(model2)
CI <- 5 * coef(d)[ ,'Std. Error']
lwr <- bar.heights - CI
upr <- bar.heights + CI
# I used the ylim= argument to pass a 2-element numeric vector specifying the y extent of the barplot. I added some extra room on the top to account for error bars.
# Importantly, assign the barplot to an object. I called it 'b' but you can call it whatever you like.
b <- barplot(bar.heights, names.arg=c("I. setosa", "I. versicolor", "I. virginica"), las=1, ylim=c(0,7.5), col=adjustcolor(plot.colors, alpha.f=0.5), main="Sepal length for 3 Irises", ylab="Sepal length (cm)")
# The object that you called your barplot is interpretted by R as the x values in the middle of each bar
b
# We'll use the arrows() function to add arrows to an existing plot. With some modifications, our arrows will have an arrowhead at each end (code=3), and the 'arrowhead' will actually be perpendicular to the arrow shaft (angle=90)
# Specify where each arrow starts (x0= and y=) and ends (x1= and y1=)
arrows(x0=b, x1=b, y0=lwr, y1=upr, code=3, angle=90, length=0.1)
#---------------
# Test yourself
#---------------
# These data represent survivorship of plant seedlings in 4 different treatments: ambient, watered, heated + watered, and heated. Make a bar plot with their 95% confidence intervals. Note these are asymmetric (more uncertainty above the mean than below) like what might come from a logistic regression model.
prop <- c(0.18, 0.25, 0.13, 0.05)
asympLCL <- c(0.14, 0.20, 0.11, 0.035)
asympUCL <- c(0.24, 0.33, 0.18, 0.09)
#---------------
# Test yourself. Error bars on scatter plots.
#---------------
# The randomly generated data below are measurements of the number of the number of angels who get their wings as a function of the number of bells that have been rung. There is some uncertainty in measuring wing acquisition (represented as the offset from the sampled mean). How would you add error bars to a scatter plot?
set.seed(13)
n <- 20 # Number of experimental trials
a <- 12
b <- 1.5
xvals <- round(runif(n)*50)
yvals <- round(a + b*xvals + rnorm(n, sd=5))
offset <- rpois(n, lambda=10)
lwr <- yvals - offset
upr <- yvals + offset
#-----------------
# Base R plotting skills: Other graphics devices
#-----------------
# 1) Use the pdf() graphics device (or png() or postscript()) to get a permanent record of your plot in the exact final format.
# First set your working directory. A working directory is where R assumes all input and output files that it interfaces with should be. When you send your code to a collaborator, they can just change the working directory once instead of changing the filepath for every input (e.g. reading data into R) or output (e.g. making a plot)
# This is how I set mine:
# 1) Make sure your script file is saved in a folder particular for the given project
# 2) Run the file.choose() function
# 3) Navigate to your script file and open it
# 4) Copy the file path in the console up until the actual file name (i.e. just the folder path)
# 5) Paste that folder into the setwd() function in quotes
# 6) Delete the file.choose() command
file.choose()
pdf("iris plot.pdf")
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, xlab="Petal length", ylab="Sepal length", col=plot.colors[iris$Species])
lines(x=df$Petal.Length, y=forecast$fit, lwd=2)
polygon.x <- c(df$Petal.Length, rev(df$Petal.Length))
polygon.y <- c(forecast$lwr, rev(forecast$upr))
polygon(x=polygon.x, y=polygon.y, col=adjustcolor("black", alpha.f=0.4), border=NA)
# Add our legend back in
legend("topleft", pch=19, col=plot.colors, legend=c("I. setosa", "I. versicolor", "I. virginica"), bty="n", text.font=3)
# Importantly, turn the device off at the end of your plotting block to complete the .pdf file.
dev.off()
#--------------
# Figure for a paper
#--------------
# To make a figure for a paper that meets particular size and style guidelines, add some more arguments to the pdf() function call.
pdf("iris plot for paper.pdf", width=3.3, height=3.3, pointsize=9, family="Times")
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, xlab="Petal length", ylab="Sepal length", col=plot.colors[iris$Species])
lines(x=df$Petal.Length, y=forecast$fit, lwd=2)
polygon.x <- c(df$Petal.Length, rev(df$Petal.Length))
polygon.y <- c(forecast$lwr, rev(forecast$upr))
polygon(x=polygon.x, y=polygon.y, col=adjustcolor("black", alpha.f=0.4), border=NA)
# Add our legend back in
legend("topleft", pch=19, col=plot.colors, legend=c("I. setosa", "I. versicolor", "I. virginica"), bty="n", text.font=3)
# Importantly, turn the device off at the end of your plotting block to complete the .pdf file.
dev.off()
#-----------------
# Base R plotting skills: Managing par()
#-----------------
# 2) You can change some fundamental plotting parameters by using par() before a plot.
# This is how you can:
# Make multipanel plots
# Give your plots more room in the inner margins
# Give your plots some room in the outer margins
#---------------
# Multi-panel plots
#---------------
setosa <- subset(iris, subset=Species=="setosa")
versicolor <- subset(iris, subset=Species=="versicolor")
virginica <- subset(iris, subset=Species=="virginica")
# Using par(mfrow=c(number of rows, number of columns))
par(mfrow=c(2,2))
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab="Sepal Length", xlab="Petal Length")
plot(x=setosa$Petal.Length, y=setosa$Sepal.Length, pch=19, las=1, col=plot.colors[1], main="I. setosa", ylab="Sepal Length", xlab="Petal Length")
plot(x=versicolor$Petal.Length, y=versicolor$Sepal.Length, pch=19, las=1, col=plot.colors[2], main="I. versicolor", ylab="Sepal Length", xlab="Petal Length")
plot(x=virginica$Petal.Length, y=virginica$Sepal.Length, pch=19, las=1, col=plot.colors[3], main="I. virginica", ylab="Sepal Length", xlab="Petal Length")
dev.off()
# Using layout(matrix())
plot.matrix <- matrix(c(1,1,2,3), nrow=2, ncol=2)
plot.matrix
layout(mat=plot.matrix)
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab="Sepal Length", xlab="Petal Length")
plot(x=versicolor$Petal.Length, y=versicolor$Sepal.Length, pch=19, las=1, col=plot.colors[2], main="I. versicolor", ylab="Sepal Length", xlab="Petal Length")
plot(x=virginica$Petal.Length, y=virginica$Sepal.Length, pch=19, las=1, col=plot.colors[3], main="I. virginica", ylab="Sepal Length", xlab="Petal Length")
# Or we can adjust the widths of the plots (the heights, too). The widths= argument should be the same length as the number of columns while the heights= argument should be the same length as the number of rows. The values represent multipliers.
layout(mat=plot.matrix, widths=c(2,1))
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab="Sepal Length", xlab="Petal Length")
plot(x=versicolor$Petal.Length, y=versicolor$Sepal.Length, pch=19, las=1, col=plot.colors[2], main="I. versicolor", ylab="Sepal Length", xlab="Petal Length")
plot(x=virginica$Petal.Length, y=virginica$Sepal.Length, pch=19, las=1, col=plot.colors[3], main="I. virginica", ylab="Sepal Length", xlab="Petal Length")
dev.off()
#----------------
# Specifying margins
#----------------
# We want to make sure not to waste white space, so we can specify the plotting margins using par(mar=c(bottom, left, top, right)). This can be important if your labels aren't fitting on the plot.
# The default is par(mar=c(5.1, 4.1, 4.1, 2.1)).
# Let's say I want to make the text bigger because the plot is for a presentation. We can use the cex (character expander) family of arguments in the plot() call.
# cex= makes the plotted points larger or smaller
# cex.main= makes the title larger
# cex.lab= makes the axis labels larger
# cex.axis= makes the numbers of the axis larger
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab="Sepal Length", xlab="Petal Length")
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab="Sepal Length", xlab="Petal Length", cex=2, cex.main=4, cex.lab=3, cex.axis=1.5)
# A solution
par(mar=c(5,6,5,2))
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab="Sepal Length", xlab="Petal Length", cex=2, cex.main=4, cex.lab=3, cex.axis=1.5)
# Note that the par(mgp=c(labels, tick marks, axis line)) method will adjust the location of those components away from the edge of the plot.
# Default is par(mgp=c(3,1,0))
par(mar=c(6,7,5,2), mgp=c(4, 1.5, 0))
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab="Sepal Length", xlab="Petal Length", cex=2, cex.main=4, cex.lab=3, cex.axis=1.5)
#--------------
# Specifying outer margins
#--------------
# Outer margins are especially great for multi-panel plots. Let's recreate the one that we had earlier and add some outer margins with par(oma=c(bottom, left, top, right))
# The default is par(oma=c(0,0,0,0))
dev.off()
par(mfrow=c(2,2), oma=c(5,5,5,0), mar=c(2,2,4,2))
# Note here that I use the font.main= argument in each of these plot calls to make the title in normal font for the first panel and then italicized for the other panels (it is bold by default; equivalent to a font.main=2)
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab=NA, xlab=NA, cex.main=2, font.main=1)
plot(x=setosa$Petal.Length, y=setosa$Sepal.Length, pch=19, las=1, col=plot.colors[1], main="I. setosa", ylab=NA, xlab=NA, cex.main=2, font.main=3)
plot(x=versicolor$Petal.Length, y=versicolor$Sepal.Length, pch=19, las=1, col=plot.colors[2], main="I. versicolor", ylab=NA, xlab=NA, cex.main=2, font.main=3)
plot(x=virginica$Petal.Length, y=virginica$Sepal.Length, pch=19, las=1, col=plot.colors[3], main="I. virginica", ylab=NA, xlab=NA, cex.main=2, font.main=3)
#-----------------
# Base R plotting skills: Using mtext() and axis()
#-----------------
# The two add on functions that I find myself using most often are mtext(), which adds text to a margin, and axis(), which draws in a user-specified axis.
# mtext() lets me:
# 1) Make axis labels that are shared between more than one panel
# 2) rotate the y-axis label so it is easier to read for presentations
# axis() lets me:
# 1) Specify exactly how many tick marks and where they'll be
# 2) Specify exactly how those tick marks will be labelled
# We actually set up the previous 4-panel plot nicely to see the functionality of mtext() and axis(). Let's recreate that plot.
par(mfrow=c(2,2), oma=c(5,6,5,0), mar=c(2,2,3,2))
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab=NA, xlab=NA, cex.main=2, font.main=1)
plot(x=setosa$Petal.Length, y=setosa$Sepal.Length, pch=19, las=1, col=plot.colors[1], main="I. setosa", ylab=NA, xlab=NA, cex.main=2, font.main=3)
plot(x=versicolor$Petal.Length, y=versicolor$Sepal.Length, pch=19, las=1, col=plot.colors[2], main="I. versicolor", ylab=NA, xlab=NA, cex.main=2, font.main=3)
plot(x=virginica$Petal.Length, y=virginica$Sepal.Length, pch=19, las=1, col=plot.colors[3], main="I. virginica", ylab=NA, xlab=NA, cex.main=2, font.main=3)
# By default, an mtext() call will put an axis label on the specified side (1=bottom, 2=left, 3=top, 4=right) of the most recently created panel. It also puts it right at the margin. Use the line= argument to move it further from the margin however far you choose. These line units are the same units as those used by par(mar=c()).
mtext(side=1, text="Petal Length", line=3)
# We can specify outer=TRUE to put this text on the outer margins. This works only because we used par(oma=c()) to make the outer margins greater than 0 on some sides.
# Recreate the plot
par(mfrow=c(2,2), oma=c(5,6,5,0), mar=c(2,2,3,2))
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab=NA, xlab=NA, cex.main=2, font.main=1)
plot(x=setosa$Petal.Length, y=setosa$Sepal.Length, pch=19, las=1, col=plot.colors[1], main="I. setosa", ylab=NA, xlab=NA, cex.main=2, font.main=3)
plot(x=versicolor$Petal.Length, y=versicolor$Sepal.Length, pch=19, las=1, col=plot.colors[2], main="I. versicolor", ylab=NA, xlab=NA, cex.main=2, font.main=3)
plot(x=virginica$Petal.Length, y=virginica$Sepal.Length, pch=19, las=1, col=plot.colors[3], main="I. virginica", ylab=NA, xlab=NA, cex.main=2, font.main=3)
# We can just use cex= to make the text bigger here (rather than cex.lab=) because we're already in the mtext() function
mtext(side=1, text="Petal Length", outer=TRUE, line=3, cex=2)
# Do the same for the y axis
mtext(side=2, text="Sepal Length", outer=TRUE, line=3, cex=2)
# And the same for an overall title
mtext(side=3, text="Sepal length vs. petal length for Irises", outer=TRUE, line=2, cex=2.1)
# We can also use the las= argument to rotate axis text using mtext(). We can make the y-axis label in the reading direction this way.
# Recreate the plot. Add some extra outer margin space to the left.
par(mfrow=c(2,2), oma=c(5,9,5,0), mar=c(2,2,3,2))
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="All Irises", ylab=NA, xlab=NA, cex.main=2, font.main=1)
plot(x=setosa$Petal.Length, y=setosa$Sepal.Length, pch=19, las=1, col=plot.colors[1], main="I. setosa", ylab=NA, xlab=NA, cex.main=2, font.main=3)
plot(x=versicolor$Petal.Length, y=versicolor$Sepal.Length, pch=19, las=1, col=plot.colors[2], main="I. versicolor", ylab=NA, xlab=NA, cex.main=2, font.main=3)
plot(x=virginica$Petal.Length, y=virginica$Sepal.Length, pch=19, las=1, col=plot.colors[3], main="I. virginica", ylab=NA, xlab=NA, cex.main=2, font.main=3)
mtext(side=1, text="Petal Length", outer=TRUE, line=3, cex=2)
# Use las=1 here to rotate the text. Use \n to insert a carriage return.
mtext(side=2, text="Sepal\nLength", outer=TRUE, line=1.5, cex=2, las=1)
# I added an \n in the middle of the character string to insert a carriage return. I also changed the line= argument from 2 to 0.
mtext(side=3, text="Sepal length vs. petal length\nfor Irises", outer=TRUE, line=0, cex=2.1)
#-----------------
# Test yourself
#-----------------
# Add a best fit line and shaded 95% confidence interval to each panel of a 4-panel Iris plot similar to the one we just created.
#------------------
# Using axis()
#------------------
# Put the axis tick marks where you want them, and label them how you like
# First reset the plotting device.
dev.off()
# Here's the original plot
plot.colors <- c("violet", "purple", "blue")
color.vector <- plot.colors[iris$Species]
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector)
# In the plot() call, suppress the x-axis with xaxt="n" and the y-axis with yaxt="n". Then we can draw them in how we'd like.
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector, yaxt="n")
# Use axis() in a similar way to using mtext(). The side= argument specifies where you want the axis (1=bottom, 2=left, 3=top, 4=right)
axis(side=2, at=c(4.5, 6, 7.5), las=1)
# Or change how the tick marks are labeled
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector, yaxt="n")
axis(side=2, at=c(4.5, 5, 6, 7.5), labels=c("4.5", "Critical\nPoint", "6", "7.5"), las=1)
# Or meaningful points
s.tick <- mean(setosa$Sepal.Length)
ve.tick <- mean(versicolor$Sepal.Length)
vi.tick <- mean(virginica$Sepal.Length)
ticks <- c(s.tick, ve.tick, vi.tick)
ticks
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector, yaxt="n")
axis(side=2, at=ticks, labels=round(ticks,digits=2), las=1)
#-----------------
# Base R plotting skills: Using Pretty Print
#-----------------
# R can render some nice typesetting for axis labels, titles, etc.
# Here's the breakdown (I'll use the main= argument for illustration):
# 1) Want only text? Just use a text string.
# ex: main="text here"
# 2) Want evaluated statements and text? Use paste().
# ex: main=paste("Mean sepal length =", mean(iris$Sepal.Length))
# 3) Want special symbols? Use expression().
# ex: main=expression(alpha)
# 4) Want special symbols and text? Use expression(paste())
# ex: main=expression(paste(mu, "Sepal length="))
# 5) Want text, symbols, and evaluated statements? Use bquote(). A tilda (~) goes between each component. Wrap statements you want evaluated in .()
# ex: main=bquote(mu[sepal ~ length] ~ "=" .(mean(iris$Sepal.Length)))
# See ?plotmath for all of the fancy typesetting you can use.
# Original plot with just text as title
plot(x=iris$Petal.Length, y=iris$Sepal.Length, pch=19, las=1, main="Iris sepal length vs. petal length", xlab="Petal length", ylab="Sepal length", col=color.vector)
# Evaluated statement AND text using paste()
plot( x=iris$Petal.Length,
y=iris$Sepal.Length,
pch=19,
las=1,
main=paste("Mean sepal length =", mean(iris$Sepal.Length)),
xlab="Petal length",
ylab="Sepal length",
col=color.vector)
# Just a special symbol? Use expression()
plot( x=iris$Petal.Length,
y=iris$Sepal.Length,
pch=19,
las=1,
main=expression(mu),
xlab="Petal length",
ylab="Sepal length",
col=color.vector)
# Special symbol plus text? Use expression(paste())
plot( x=iris$Petal.Length,
y=iris$Sepal.Length,
pch=19,
las=1,
main=expression(paste(mu["sepal length"])),
xlab="Petal length",
ylab="Sepal length",
col=color.vector)
# Special symbol plus text plus evaluated statements? Use bquote(). Put a ~ in between each component. Equal signs go in quotes. Wrap statements you want evaluated in .()
plot( x=iris$Petal.Length,
y=iris$Sepal.Length,
pch=19,
las=1,
main=bquote(mu[sepal ~ length] ~ "=" ~ .(mean(iris$Sepal.Length))),
xlab="Petal length",
ylab="Sepal length",
col=color.vector)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script type="text/javascript">
window.onload = function() {
var imgs = document.getElementsByTagName('img'), i, img;
for (i = 0; i < imgs.length; i++) {
img = imgs[i];
// center an image if it is the only element of its parent
if (img.parentElement.childElementCount === 1)
img.parentElement.style.textAlign = 'center';
}
};
</script>
<!-- Styles for R syntax highlighter -->
<style type="text/css">
pre .operator,
pre .paren {
color: rgb(104, 118, 135)
}
pre .literal {
color: #990073
}
pre .number {
color: #099;
}
pre .comment {
color: #998;
font-style: italic
}
pre .keyword {
color: #900;
font-weight: bold
}
pre .identifier {
color: rgb(0, 0, 0);
}
pre .string {
color: #d14;
}
</style>
<!-- R syntax highlighter -->
<script type="text/javascript">
var hljs=new function(){function m(p){return p.replace(/&/gm,"&amp;").replace(/</gm,"&lt;")}function f(r,q,p){return RegExp(q,"m"+(r.cI?"i":"")+(p?"g":""))}function b(r){for(var p=0;p<r.childNodes.length;p++){var q=r.childNodes[p];if(q.nodeName=="CODE"){return q}if(!(q.nodeType==3&&q.nodeValue.match(/\s+/))){break}}}function h(t,s){var p="";for(var r=0;r<t.childNodes.length;r++){if(t.childNodes[r].nodeType==3){var q=t.childNodes[r].nodeValue;if(s){q=q.replace(/\n/g,"")}p+=q}else{if(t.childNodes[r].nodeName=="BR"){p+="\n"}else{p+=h(t.childNodes[r])}}}if(/MSIE [678]/.test(navigator.userAgent)){p=p.replace(/\r/g,"\n")}return p}function a(s){var r=s.className.split(/\s+/);r=r.concat(s.parentNode.className.split(/\s+/));for(var q=0;q<r.length;q++){var p=r[q].replace(/^language-/,"");if(e[p]){return p}}}function c(q){var p=[];(function(s,t){for(var r=0;r<s.childNodes.length;r++){if(s.childNodes[r].nodeType==3){t+=s.childNodes[r].nodeValue.length}else{if(s.childNodes[r].nodeName=="BR"){t+=1}else{if(s.childNodes[r].nodeType==1){p.push({event:"start",offset:t,node:s.childNodes[r]});t=arguments.callee(s.childNodes[r],t);p.push({event:"stop",offset:t,node:s.childNodes[r]})}}}}return t})(q,0);return p}function k(y,w,x){var q=0;var z="";var s=[];function u(){if(y.length&&w.length){if(y[0].offset!=w[0].offset){return(y[0].offset<w[0].offset)?y:w}else{return w[0].event=="start"?y:w}}else{return y.length?y:w}}function t(D){var A="<"+D.nodeName.toLowerCase();for(var B=0;B<D.attributes.length;B++){var C=D.attributes[B];A+=" "+C.nodeName.toLowerCase();if(C.value!==undefined&&C.value!==false&&C.value!==null){A+='="'+m(C.value)+'"'}}return A+">"}while(y.length||w.length){var v=u().splice(0,1)[0];z+=m(x.substr(q,v.offset-q));q=v.offset;if(v.event=="start"){z+=t(v.node);s.push(v.node)}else{if(v.event=="stop"){var p,r=s.length;do{r--;p=s[r];z+=("</"+p.nodeName.toLowerCase()+">")}while(p!=v.node);s.splice(r,1);while(r<s.length){z+=t(s[r]);r++}}}}return z+m(x.substr(q))}function j(){function q(x,y,v){if(x.compiled){return}var u;var s=[];if(x.k){x.lR=f(y,x.l||hljs.IR,true);for(var w in x.k){if(!x.k.hasOwnProperty(w)){continue}if(x.k[w] instanceof Object){u=x.k[w]}else{u=x.k;w="keyword"}for(var r in u){if(!u.hasOwnProperty(r)){continue}x.k[r]=[w,u[r]];s.push(r)}}}if(!v){if(x.bWK){x.b="\\b("+s.join("|")+")\\s"}x.bR=f(y,x.b?x.b:"\\B|\\b");if(!x.e&&!x.eW){x.e="\\B|\\b"}if(x.e){x.eR=f(y,x.e)}}if(x.i){x.iR=f(y,x.i)}if(x.r===undefined){x.r=1}if(!x.c){x.c=[]}x.compiled=true;for(var t=0;t<x.c.length;t++){if(x.c[t]=="self"){x.c[t]=x}q(x.c[t],y,false)}if(x.starts){q(x.starts,y,false)}}for(var p in e){if(!e.hasOwnProperty(p)){continue}q(e[p].dM,e[p],true)}}function d(B,C){if(!j.called){j();j.called=true}function q(r,M){for(var L=0;L<M.c.length;L++){if((M.c[L].bR.exec(r)||[null])[0]==r){return M.c[L]}}}function v(L,r){if(D[L].e&&D[L].eR.test(r)){return 1}if(D[L].eW){var M=v(L-1,r);return M?M+1:0}return 0}function w(r,L){return L.i&&L.iR.test(r)}function K(N,O){var M=[];for(var L=0;L<N.c.length;L++){M.push(N.c[L].b)}var r=D.length-1;do{if(D[r].e){M.push(D[r].e)}r--}while(D[r+1].eW);if(N.i){M.push(N.i)}return f(O,M.join("|"),true)}function p(M,L){var N=D[D.length-1];if(!N.t){N.t=K(N,E)}N.t.lastIndex=L;var r=N.t.exec(M);return r?[M.substr(L,r.index-L),r[0],false]:[M.substr(L),"",true]}function z(N,r){var L=E.cI?r[0].toLowerCase():r[0];var M=N.k[L];if(M&&M instanceof Array){return M}return false}function F(L,P){L=m(L);if(!P.k){return L}var r="";var O=0;P.lR.lastIndex=0;var M=P.lR.exec(L);while(M){r+=L.substr(O,M.index-O);var N=z(P,M);if(N){x+=N[1];r+='<span class="'+N[0]+'">'+M[0]+"</span>"}else{r+=M[0]}O=P.lR.lastIndex;M=P.lR.exec(L)}return r+L.substr(O,L.length-O)}function J(L,M){if(M.sL&&e[M.sL]){var r=d(M.sL,L);x+=r.keyword_count;return r.value}else{return F(L,M)}}function I(M,r){var L=M.cN?'<span class="'+M.cN+'">':"";if(M.rB){y+=L;M.buffer=""}else{if(M.eB){y+=m(r)+L;M.buffer=""}else{y+=L;M.buffer=r}}D.push(M);A+=M.r}function G(N,M,Q){var R=D[D.length-1];if(Q){y+=J(R.buffer+N,R);return false}var P=q(M,R);if(P){y+=J(R.buffer+N,R);I(P,M);return P.rB}var L=v(D.length-1,M);if(L){var O=R.cN?"</span>":"";if(R.rE){y+=J(R.buffer+N,R)+O}else{if(R.eE){y+=J(R.buffer+N,R)+O+m(M)}else{y+=J(R.buffer+N+M,R)+O}}while(L>1){O=D[D.length-2].cN?"</span>":"";y+=O;L--;D.length--}var r=D[D.length-1];D.length--;D[D.length-1].buffer="";if(r.starts){I(r.starts,"")}return R.rE}if(w(M,R)){throw"Illegal"}}var E=e[B];var D=[E.dM];var A=0;var x=0;var y="";try{var s,u=0;E.dM.buffer="";do{s=p(C,u);var t=G(s[0],s[1],s[2]);u+=s[0].length;if(!t){u+=s[1].length}}while(!s[2]);if(D.length>1){throw"Illegal"}return{r:A,keyword_count:x,value:y}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:m(C)}}else{throw H}}}function g(t){var p={keyword_count:0,r:0,value:m(t)};var r=p;for(var q in e){if(!e.hasOwnProperty(q)){continue}var s=d(q,t);s.language=q;if(s.keyword_count+s.r>r.keyword_count+r.r){r=s}if(s.keyword_count+s.r>p.keyword_count+p.r){r=p;p=s}}if(r.language){p.second_best=r}return p}function i(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"<br>")}return r}function n(t,w,r){var x=h(t,r);var v=a(t);var y,s;if(v){y=d(v,x)}else{return}var q=c(t);if(q.length){s=document.createElement("pre");s.innerHTML=y.value;y.value=k(q,c(s),x)}y.value=i(y.value,w,r);var u=t.className;if(!u.match("(\\s|^)(language-)?"+v+"(\\s|$)")){u=u?(u+" "+v):v}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){s=t.parentNode;var p=document.createElement("div");p.innerHTML="<pre><code>"+y.value+"</code></pre>";t=p.firstChild.firstChild;p.firstChild.cN=s.cN;s.parentNode.replaceChild(p.firstChild,s)}else{t.innerHTML=y.value}t.className=u;t.result={language:v,kw:y.keyword_count,re:y.r};if(y.second_best){t.second_best={language:y.second_best.language,kw:y.second_best.keyword_count,re:y.second_best.r}}}function o(){if(o.called){return}o.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p<r.length;p++){var q=b(r[p]);if(q){n(q,hljs.tabReplace)}}}function l(){if(window.addEventListener){window.addEventListener("DOMContentLoaded",o,false);window.addEventListener("load",o,false)}else{if(window.attachEvent){window.attachEvent("onload",o)}else{window.onload=o}}}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=n;this.initHighlighting=o;this.initHighlightingOnLoad=l;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="\\b(0[xX][a-fA-F0-9]+|(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.ER="(?![\\s\\S])";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(r,s){var p={};for(var q in r){p[q]=r[q]}if(s){for(var q in s){p[q]=s[q]}}return p}}();hljs.LANGUAGES.cpp=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1,restrict:1,_Bool:1,complex:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};return{dM:{k:a,i:"</",c:[hljs.CLCM,hljs.CBLCLM,hljs.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},hljs.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:a,r:10,c:["self"]}]}}}();hljs.LANGUAGES.r={dM:{c:[hljs.HCM,{cN:"number",b:"\\b0[xX][0-9a-fA-F]+[Li]?\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\b\\d+(?:[eE][+\\-]?\\d*)?L\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\b\\d+\\.(?!\\d)(?:i\\b)?",e:hljs.IMMEDIATE_RE,r:1},{cN:"number",b:"\\b\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"keyword",b:"(?:tryCatch|library|setGeneric|setGroupGeneric)\\b",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\.\\.\\.",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\.\\.\\d+(?![\\w.])",e:hljs.IMMEDIATE_RE,r:10},{cN:"keyword",b:"\\b(?:function)",e:hljs.IMMEDIATE_RE,r:2},{cN:"keyword",b:"(?:if|in|break|next|repeat|else|for|return|switch|while|try|stop|warning|require|attach|detach|source|setMethod|setClass)\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"literal",b:"(?:NA|NA_integer_|NA_real_|NA_character_|NA_complex_)\\b",e:hljs.IMMEDIATE_RE,r:10},{cN:"literal",b:"(?:NULL|TRUE|FALSE|T|F|Inf|NaN)\\b",e:hljs.IMMEDIATE_RE,r:1},{cN:"identifier",b:"[a-zA-Z.][a-zA-Z0-9._]*\\b",e:hljs.IMMEDIATE_RE,r:0},{cN:"operator",b:"<\\-(?!\\s*\\d)",e:hljs.IMMEDIATE_RE,r:2},{cN:"operator",b:"\\->|<\\-",e:hljs.IMMEDIATE_RE,r:1},{cN:"operator",b:"%%|~",e:hljs.IMMEDIATE_RE},{cN:"operator",b:">=|<=|==|!=|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||\\$|:",e:hljs.IMMEDIATE_RE,r:0},{cN:"operator",b:"%",e:"%",i:"\\n",r:1},{cN:"identifier",b:"`",e:"`",r:0},{cN:"string",b:'"',e:'"',c:[hljs.BE],r:0},{cN:"string",b:"'",e:"'",c:[hljs.BE],r:0},{cN:"paren",b:"[[({\\])}]",e:hljs.IMMEDIATE_RE,r:0}]}};
hljs.initHighlightingOnLoad();
</script>
<style type="text/css">
body, td {
font-family: sans-serif;
background-color: white;
font-size: 13px;
}
body {
max-width: 800px;
margin: auto;
padding: 1em;
line-height: 20px;
}
tt, code, pre {
font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace;
}
h1 {
font-size:2.2em;
}
h2 {
font-size:1.8em;
}
h3 {
font-size:1.4em;
}
h4 {
font-size:1.0em;
}
h5 {
font-size:0.9em;
}
h6 {
font-size:0.8em;
}
a:visited {
color: rgb(50%, 0%, 50%);
}
pre, img {
max-width: 100%;
}
pre {
overflow-x: auto;
}
pre code {
display: block; padding: 0.5em;
}
code {
font-size: 92%;
border: 1px solid #ccc;
}
code[class] {
background-color: #F8F8F8;
}
table, td, th {
border: none;
}
blockquote {
color:#666666;
margin:0;
padding-left: 1em;
border-left: 0.5em #EEE solid;
}
hr {
height: 0px;
border-bottom: none;
border-top-width: thin;
border-top-style: dotted;
border-top-color: #999999;
}
@media print {
* {
background: transparent !important;
color: black !important;
filter:none !important;
-ms-filter: none !important;
}
body {
font-size:12pt;
max-width:100%;
}
a, a:visited {
text-decoration: underline;
}
hr {
visibility: hidden;
page-break-before: always;
}
pre, blockquote {
padding-right: 1em;
page-break-inside: avoid;
}
tr, img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page :left {
margin: 15mm 20mm 15mm 10mm;
}
@page :right {
margin: 15mm 10mm 15mm 20mm;
}
p, h2, h3 {
orphans: 3; widows: 3;
}
h2, h3 {
page-break-after: avoid;
}
}
</style>
</head>
<body>
<p>#\title{\title{}}</p>
<p>This report was automatically generated with the R package <strong>knitr</strong>
(version 1.9).</p>
<pre><code class="r">### Title: Back to basics: High quality plots using base R graphics
### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015
###
### Date created: 20150418
### Last updated: 20150423
###
### Author: Michael Koontz
### Email: mikoontz@gmail.com
### Twitter: @michaeljkoontz
###
### Purpose: Introduce basic to intermediate plotting capabilities of base R graphics
###
### Basic methods
### 1) Basic scatterplot and labeling a plot (Line 44)
### 2) Plotting groups in different ways on the same plot (Line 72)
### 3) Adding a legend (Line 120)
### 4) Adding a best fit line (Line 150)
### 5) Adding a 95% confidence interval (Line 150)
### 6) Shaded confidence intervals (Line 223)
### 7) Bar plots (Line 260)
### 8) Error bars (Line 274)
###
### Intermediate methods
### 1) Using other graphics devices like pdf() (Line 324)
### 2) Using par() for multipanel plots (Line 380)
### 3) Using par() for margin adjustments (Line 438)
### 4) Using axis() and mtext() (Line 484)
### 5) Pretty print from plotmath (Line 601)
# We&#39;ll start with the very tractable &#39;trees&#39; dataset, which is built into R. It
# describes the girth, height, and volume of 31 black cherry trees.
trees
</code></pre>
<pre><code>## Girth Height Volume
## 1 8.3 70 10.3
## 2 8.6 65 10.3
## 3 8.8 63 10.2
## 4 10.5 72 16.4
## 5 10.7 81 18.8
## 6 10.8 83 19.7
## 7 11.0 66 15.6
## 8 11.0 75 18.2
## 9 11.1 80 22.6
## 10 11.2 75 19.9
## 11 11.3 79 24.2
## 12 11.4 76 21.0
## 13 11.4 76 21.4
## 14 11.7 69 21.3
## 15 12.0 75 19.1
## 16 12.9 74 22.2
## 17 12.9 85 33.8
## 18 13.3 86 27.4
## 19 13.7 71 25.7
## 20 13.8 64 24.9
## 21 14.0 78 34.5
## 22 14.2 80 31.7
## 23 14.5 74 36.3
## 24 16.0 72 38.3
## 25 16.3 77 42.6
## 26 17.3 81 55.4
## 27 17.5 82 55.7
## 28 17.9 80 58.3
## 29 18.0 80 51.5
## 30 18.0 80 51.0
## 31 20.6 87 77.0
</code></pre>
<pre><code class="r">dim(trees)
</code></pre>
<pre><code>## [1] 31 3
</code></pre>
<pre><code class="r">head(trees)
</code></pre>
<pre><code>## Girth Height Volume
## 1 8.3 70 10.3
## 2 8.6 65 10.3
## 3 8.8 63 10.2
## 4 10.5 72 16.4
## 5 10.7 81 18.8
## 6 10.8 83 19.7
</code></pre>
<pre><code class="r"># Remember how we access the columns of a data.frame:
trees$Girth
</code></pre>
<pre><code>## [1] 8.3 8.6 8.8 10.5 10.7 10.8 11.0 11.0 11.1 11.2 11.3 11.4 11.4 11.7
## [15] 12.0 12.9 12.9 13.3 13.7 13.8 14.0 14.2 14.5 16.0 16.3 17.3 17.5 17.9
## [29] 18.0 18.0 20.6
</code></pre>
<pre><code class="r">trees$Volume
</code></pre>
<pre><code>## [1] 10.3 10.3 10.2 16.4 18.8 19.7 15.6 18.2 22.6 19.9 24.2 21.0 21.4 21.3
## [15] 19.1 22.2 33.8 27.4 25.7 24.9 34.5 31.7 36.3 38.3 42.6 55.4 55.7 58.3
## [29] 51.5 51.0 77.0
</code></pre>
<pre><code class="r"># Basic plot function takes x argument and a y argument Default plot type is
# points, but you can change it to lines or both points and lines by adding the
# &#39;type&#39; argument
plot(x = trees$Girth, y = trees$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/CFQjVh1tH62IHVfv3o/5i+vXAFk29CTmg62Hr1b2x0PpwMfmcM8mPSRW/m/f4GN8+0crYscNHlRft0oceyQY/tg092zSRUddpF/WFyNnSn3Fsn7UuMGPzfGeTbmsxw0QTAzBxBBMDMHEEEwMwcQQTAzBxBBMDMHEzDfY/tfnwO80L/P5t+TfPfmXx5sbN//DvPkGCwao7v/+fbN+2fg3QO62pxsT7LbcBLr/5+df7rbV12tbVodJldfVqlo37w3V9Z9Puw/uVu9+Otx41HsPic022GHSvG8OecW6+Vqtjm/RuFhf32xxwZpbuRsPvvjgBuYdzGWqDm8zNV93x+szqs8Pax/Mncxcyn/crZobj7hsJrn5B2sSHQ92Lpk/HLpczSGxIJgZx2DuSPeyWTdfS/9+f166c1iRHxYd+0eCmbF/vPcp6rNFhz8G+quZmnfv/Xvy67oJ1tyYYEZVI67Ns2KRwZQRTAzBxBBMDMHEEEwMwcQQTAzBxBBMDMHEEEwMwcQQTAzBxBBMzP98nlKKAr5ZngAAAABJRU5ErkJggg==" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r">plot(x = trees$Girth, y = trees$Volume, type = &quot;l&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAe1BMVEUAAAAAADoAAGYAOjoAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6kNtmAABmADpmAGZmOgBmOpBmZjpmkJBmtttmtv+QOgCQOjqQOmaQ2/+2ZgC2Zjq2/7a2///bkDrbtmbb25Db/7bb////tmb/25D/29v//7b//9v///+MJoIzAAAACXBIWXMAAAsSAAALEgHS3X78AAAMxklEQVR4nO2da2PaOBZA3WxIZ7e03Z0OdMJM2NmQSfz/f+FamBAMlq2XrXutcz4QGhDWvScS8uu2qkEVVXhLyECMsOCWEAzClIEwZSBMGQhTBsKUgTBlIEwZCFMGwpSBMGUgTBkIUwbCxFN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CGroRML4zhlZTJhaErLRMLY3ilZlph6ErOlMIYXhMwoTB0TYFzvcTvT341fxle0+Ao7PXr3dNI+b2qS9JewhnHqtq//9mMsBlr/oINnylxxpq/YANhyvARNkPNXxjDR9iM/9EA2JhsWQ/TkPsOTPAEYcpAmDIQpgyEKQNhykCYMqKEQQZix0lw8+D7N0tvhzBl7RCmrB3ClLVjracMhCkDYcpAmDIQpgyEKQNhykCYMhCmjChh+6paBTTruwbLtd3b1n+bx+01vV2HtAuIMazdKbKxvMQIM5eWbn2zbrm1wrXdflX7bvPYruntg6ewY7uAGAPbtZGN5iVW2OW1wG7c3lrh087gN1RO7d5+/uonrG3nPSyD4zPs16PtoqbEl4dP3n2q+6/Ud2338cOz3X4dNCXufjyETYkhuWkajuYlRtjhPmhKjBTWTBoB22v+csOE3T8H9TMkNyaySYWZDBwCVh19t1a4tqtfPof84Zo1QFX5fokZYRv/1crraSr1zM0xskmnxIP56/Oe4/tvrXBt592ojlslhs4E/rlpI5t00VHv5l/W7wJHSh2xrA9q552bU2RTLushAwhTBsKUgTBlIEwZCFMGwpSBMGUgTBkIUwbClLFcYa//eba80h7mM6fkPz2aw+Ptm9sn4lmuMKuAw/1/f9tu3rbmBMjd0/nNCMtLM4Du//rXv++eDu/XtqyOg2pdH1aHTXtuqK7/eHz50rzr0z+Pbw469zAzixV2HDSf2ylvt2kfD6vTKZpG1vvJlkZY+67mzd4XH2Rg2cIaTYfjaab28eV0fcbhx8PGCGu+zBqVfzXvat8ccNnM7CxfWKvoNNk1ysx02Ohqp8QdwsRwEtbMdG/bTfu4N+f71/vmO2y3Pi46Xr8iTAyvX++Nivpi0WHmQHM1U3v23pyT39StsPbNCBPKIeDaPCkUKUwzCFMGwpSBMGUgTBkIUwbClIEwZSBMGQhTBsKUgTBlIEwZCFMGwpSBMGX8H5hwGBoD6Mf7AAAAAElFTkSuQmCC" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r">plot(x = trees$Girth, y = trees$Volume, type = &quot;b&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAe1BMVEUAAAAAADoAAGYAOjoAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6kNtmAABmADpmAGZmOgBmOpBmZjpmkJBmtttmtv+QOgCQOjqQOmaQ2/+2ZgC2Zjq2/7a2///bkDrbtmbb25Db/7bb////tmb/25D/29v//7b//9v///+MJoIzAAAACXBIWXMAAAsSAAALEgHS3X78AAAMrElEQVR4nO2dC3vaOBZA3WxIZ7ek3Z0OdMIM7GzIEP//X7h+EIrBsvWyda91zveVtAWBdU+vJNvitihBFYV/S0hAiDDvluANwpSBMGUgTBkIUwbClIEwZSBMGQhTBsKUgTBlIEw69eXD6z8iTDZF2Q00woSDMGUgTBvMYbpBmDIQpgyEyeYuxggTzX2IESYahOmiJ8IIkwzCdNEXYIQJBmG66I0vwuSCMF30hxdhYkGYLgzRRZhUEKYLU3ARJhNjbBEmE4TpwhxahIkEYboYiCzCJIIwXQwFFmECQZguBuOKMHkgTBfDYUWYNEaiijBpRBF2qOu+rctjUWzs3xp8GAuqdYa9/bI/fX2pHu3fGzyIJmy3Kd++vL7/eLF/b3BnNKa2wipZ5XHVeGvbFTffDIQoRBO2W5cdYVZvDq6Mh9RS2OnbvmRInJ5owuoRsWTRMTUWEbUUVo+GJcv6qYknzPftwQWbgCJMEAjThVU8ESYGu3AiTAwI04VlNBEmBYTpwjaYCBMCwnRhHUuEyQBhurAPJcJEgDBdOEQSYQJwCSTCBIAwXTjFEWHpQZgu3MKIsOQgTBeOUURYahCmC9cgIiwxCNOFcwwRlhaE6cI9hAhLiUcEEZYShOnCJ4AISwjCdOEVP4SlA2G68AsfwpKBMF14Rg9hqUCYLnyDh7BEIEwX3rFDWBJCgo6wBCBMFwGRQ1gKphd2KIoVxcFiERI4O2F1pcTthvJ7kZhe2GFdP1LgMg5BcbMTt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f3kxwtJSJdDjX//698P++LG3ZdUk1bo8ro6b9t5QWf7x8valetWnfzYv9rr3MDOLFdYkzed2yNtt2sfj6nyLppL1cbOlEta+qnqx8+aDBCxbWKXp2Nxmah/fzvszjt+fNrWwajKrVP5Vvap9sce2mdlZvrBW0Xmwq5TVw2Glqx0SdwgTw1lYNdK9bzft46G+378+VHPYbt0sOk7PCBPD6fmxVlFeLTrqMbDezdTeva/vyW/KVlj7YoQJ5eixN08KWQrTDMKUgTBlIEwZCFMGwpSBMGUgTBkIUwbClIEwZSBMGQhTBsKUgTBlIEwZ/wdfEw5Cwdt+zgAAAABJRU5ErkJggg==" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r"># pch: &#39;plotting character&#39; changes the type of point that is used (default is an
# open circle); remember pch=19!
plot(x = trees$Girth, y = trees$Volume, pch = 19)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAe1BMVEUAAAAAADoAAGYAOjoAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6kNtmAABmADpmAGZmOgBmOpBmZjpmkJBmtttmtv+QOgCQOjqQOmaQ2/+2ZgC2Zjq2/7a2///bkDrbtmbb25Db/7bb////tmb/25D/29v//7b//9v///+MJoIzAAAACXBIWXMAAAsSAAALEgHS3X78AAAKBklEQVR4nO3dYWPTNhtGYdM1ZRsubIMEaoi31Vnq//8LJ8VtScCyZSdWnts+14e+76CibQ6y5cQRWQ0p2fiRuIJzgo0eidEIJoZgYggmhmBiCCaGYGIIJoZgYggmhmBiCGadf/rw+D8JZlvzhO/RfxPMNoKJIZgazmHaCCaGYGIIJoZgYggmhmBiCCaGYGIIJoZgYggmhmBiCCaGYGIIJoZgYggmhmBiCCaGYGIIJoZgYggmhmBiCCaGYGIIJoZgYggmJi5Y6d+klNdVlq1PxiK56Bm2+3W7f//gPh6PRXLRwYp1vXv3+PT54X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t2uikKdxZOJXq/xA/bzj1/T/cr597dyUQG29/fbDu33yNYIpG7an/55mZY156/BEtkyCGxcwtZzmFpXCwY0hgSbPo9f9FrSLC0/9AAWl1qWY9EeKZDDMHEEEwMwcQQTAzBxBBMzFnBcAXnzpPRw8cOXPw4gomNI5jYOIKJjWOtJ4ZgYggmhmBiCCaGYGIIJoZgYggm5qxgZZatRgxruwcrdtzTZvjXPHw9993mY8aN+BnHjXv+yfoel3OC+VtLN0Mf9cBbK2LHlat66Nc8jHPf7d3AYIdxI37GkeOan6z3cTk32PG9wHF+fmvFkHHesKnyPO7p81/DgjXjBk/L0T+fV+a94846JO7u3gz+nur2O/Vjx33/n4HjynzUIbH4eDfukDjmsXEDex+Xc4JVt6MOiWcGcweNEV/P/c0dF+z2cdT3Oeax8T/ZpMH8I1CNWHW0vbUidly9ezvmL65fA2TZ0JOYD7YevlrZPx9KBz42h59s0kNi5f/2DT7Gt7+1Inbc4EH1eavEsUeC4Y9N85NNuuioi/TL+mLkTKnPWNaPGjf4sXn+yaZc1uMKCCaGYGIIJoZgYggmhmBiCCaGYGIIJoZgYuYbbP/nY+B3mqf5/Evybx780+PNJzf/x7z5BgsGqG7//rRZP238CyA329dPJth1uQl0+8/vf9xsq5d7W1aHSZXX1apaN68N1fXXh90791lvfjt88qjXHhKbbbDDpHnbHPKKdfOxWj2/RONivbzY4oI1n+U+efDNB1cw72AuU3V4man5uHu+P6P6eLf2wdzJzKX8x31W88kjbptJbv7BmkTPBzuXzB8OXa7mkFgQzIznYO5I97RZNx9L/3p/XrpzWJEfFh37e4KZsb+/9Snqo0WHPwb6u5maV+/9a/LrugnWfDLBjKpG3JtnxSKDKSOYGIKJIZgYgokhmBiCiSGYGIKJIZgYgokhmBiCiSGYGIKJIZiY/wElginCO6o98QAAAABJRU5ErkJggg==" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r"># main: adds a title
plot(x = trees$Girth, y = trees$Volume, pch = 19, main = &quot;Girth vs. Volume for Black Cherry Trees&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAjVBMVEUAAAAAADoAAGYAOjoAOmYAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6kNtmAABmADpmAGZmOgBmOpBmZjpmkJBmtrZmtttmtv+QOgCQOjqQOmaQkGaQtpCQ2/+2ZgC2Zjq2kDq2/7a2///bkDrbtmbb25Db/7bb/9vb////tmb/25D/29v//7b//9v///9QssF4AAAACXBIWXMAAAsSAAALEgHS3X78AAAMSUlEQVR4nO2de2PixhVHZbeGJF28SbMNbForCWo2FsX6/h+v85CEsCUYCSTmJ875gwWsq9fRzFw9uJsUU7FbPr3af77fFvvnx+3bJkmSv/9kXhburfnXTZYnZrL988PL/tl+6WIcb5uHFzMTM1VaTu5n82jn9/SaJxXmCz/Fyoe5uVQx5UfzBxtduFD7rlqaXxf7+XGbJevGmr9t1sVhTasl+Pn95V5/N9OnZiUb23u09NUh7P3GhZMMFpDADbhEWM/pc3tg2nbgD1/XYOwht/Ztxx7qbrrMHID2W3cQ2kZQYab4y7YnNyMz2fpdC6ua3MNL2drKg93OrI4pF+tm56fyq+M/P25z3y5tG/+hbGBF9V1xWNN6CX5+1evTt+dFtbplC7N/qKeu33zYuECmFOY2oENYudPddObNN7cHd8vDTnekD/9ZroqTwmyfFizM7bDUz8ctzAlblH897NFml3jcAR8LKzK/go3t7RL2ceNCd/p0wkx37rf7jDDj5d/1IZ1WR7kl95u4W7rD3B6mbihcGxHHwsrhsjGPOqZLmG3Xu6UVZ741H6rv/JT2Teb0lGtaL+FImLFwcNAQVk/9ccV6MqUwf1AlSaPrKtwovHgnrNzs6pgvd2zhdpybppl0lB+OhdVfujC3Xw5JR3uXmJfvm0lHveQ8qaOrNa2WcCSsPCarzaiFHdanelNtXP+dPqEwv95+uKiFmTX3I9NBmJnMdUt2o1y7qLcrLQ/5LHEpl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BsxbmNGUu9tM/nVXPp+Rf1murTAzmBmVf5qp/MQDHpuZnPkL84rKzs4os92h0eW7xBRh0VAKMz3d22btXzN7v3+VmTEsXbmkY/+MsGjYPz9ZFUUj6bB9oH2ayd+9t/fk14UX5idGWKTkA57Ni4W7FKYMwsRAmBgIEwNhYiBMDISJgTAxECYGwsRAmBgIEwNhYiBMDISJgTAx/g9QancoYNlWRwAAAABJRU5ErkJggg==" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r"># xlab: adds an x axis label
plot(x = trees$Girth, y = trees$Volume, pch = 19, main = &quot;Girth vs. Volume for Black Cherry Trees&quot;,
xlab = &quot;Tree Girth (in)&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAkFBMVEUAAAAAADoAAGYAOjoAOmYAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6ZmY6ZrY6kNtmAABmADpmAGZmOgBmOpBmZjpmkJBmtrZmtttmtv+QOgCQOjqQOmaQkGaQtpCQ2/+2ZgC2Zjq2kDq2/7a2///bkDrb25Db/7bb/9vb////tmb/25D/29v//7b//9v///+WfNmwAAAACXBIWXMAAAsSAAALEgHS3X78AAAMY0lEQVR4nO2de2ObyBVHsVtLyW5anKS7rZS0Jl3JWaNafP9v13mAhGyQBiTQ/NA5fzh6cHkdZuby0E1SjMVm/vBi//m4Kl4f71fbZZIkf/1q/szcS/OvmyxPzGSvj3dPr4/2Qxfj2C7vnsxMzFRZObmfzb2d38NLnlSYD/wUqQ9zc6liyrfmCxtduFD7qlqaXxf7/n61Tha1Nd8uF8V+Tasl+Pn96f7+10yfmZWsbe/B0tN92NuNCyfpLSCBK3COsI7T5/bAtO3AH76uwdhDbuHbjj3U3XRrcwDaT91BaBtBhZniT9ue3IzMZIs3LaxqcndPZWsrD3Y7s11MuVg3Oz+VXx3//n6V+3Zp2/gvZQMrq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m2Xv7bOs05NxZ3WJm/ld53Uqmp/UD43b/9Mxbp326hKz3+f9usQ++8YEntwv5wjLH3p1iWcKM51Gj+WZI7efsIeXXuvZZ9/YLRtUmN0DeY+so+mnFaFxxeZDnwPX5gBJknaPszuvq+nXsivtuG/clg3aJeb26Eu7xzX9tCI0rnNQcV6W2Lcn6L5v/JYNmnQU2fhpfdazpRRnpPW94jrvm3LLhkzr4QogTAyEiYEwMRAmBsLEQJgYCBMDYWIgTAyEiTE9YZu5vSjXeDPK3oU3X2w+vZg3r/948S8c7tahe2U+H2lNezE9YUXrZd7t0nye35fXwo2gvbDN3/eT5c3RkTBZYZtfv96v8uq5Fnfh3N7yKIofT5tPz79+vfsleTD/lJfUf9h29/y3R/t2+737HZzxmK6wD77vyxb+b7FveEaN/9JMU97FdrdUnz+u/B2VHnfRR2O6woym3N1iyqtbaPbjLEmMwWfzpe8S/e3djXv/XL7t/uDNiExbmO8JqxuJvkvMEBYdlTDT5W2XC/+3KJOO18cGYWWXWL7t+kjAqExaWHGYdPjb8Auvxph7eN498eKTDv+WpEMA0no19uMWJ85wSRAmBsLEQJgYCBMDYWIgTAyEiYEwMRAmBsLEQJgYCBMDYWIgTIz/A/lZR39lxdkbAAAAAElFTkSuQmCC" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r"># ylab: adds a y axis label
plot(x = trees$Girth, y = trees$Volume, pch = 19, main = &quot;Girth vs. Volume for Black Cherry Trees&quot;,
xlab = &quot;Tree Girth (in)&quot;, ylab = &quot;Tree Volume (cu ft)&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAmVBMVEUAAAAAADoAAGYAOjoAOmYAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6ZmY6ZrY6kNtmAABmADpmAGZmOgBmOpBmZjpmZrZmkJBmtrZmtttmtv+QOgCQOjqQOmaQkG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gYCBMDYWIgTAyEiYEwMRAmBsLEQJgYCBMDYWIgTIz/AwgpoPQ2GR2LAAAAAElFTkSuQmCC" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r"># las: rotates axis labels; las=1 makes them all parallel to reading direction
plot(x = trees$Girth, y = trees$Volume, pch = 19, main = &quot;Girth vs. Volume for Black Cherry Trees&quot;,
xlab = &quot;Tree Girth (in)&quot;, ylab = &quot;Tree Volume (cu ft)&quot;, las = 1)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAmVBMVEUAAAAAADoAAGYAOjoAOmYAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6ZmY6ZrY6kNtmAABmADpmAGZmOgBmOpBmZjpmZrZmkJBmtrZmtttmtv+QOgCQOjqQOmaQkGaQtpCQ2/+2ZgC2Zjq2Zma2kDq225C2/7a2///bkDrb25Db/7bb/9vb////tmb/25D/29v//7b//9v///+dQZAKAAAACXBIWXMAAAsSAAALEgHS3X78AAAMaUlEQVR4nO2de2PayBVHFbc2yW5a3KTbbXG2a6UP8K6hoO//4ToPCYQtoZGAYX7SOX84PHTR42hmrl43WRGLzez+1f7zaVlsH++Wu6csy/741fx5cC/Nv26ydWYm2z5+eN4+2g9djGP39OHZ/IiZKi8n9z9zZ3/v/nWdVZgP/BRzH+Z+pYop35ovbHThQu2ram5+Wez7u+UqW9SWfPe0KA5LWs3B/97v7u+/zfS5Wcja+h7NfX4Ie7ty4WSDBWRwA84R1nP6td0xbTvwu69rMHaXW/i2Y3d1N93K7ID2U7cT2kZQYab43bYn90NmssWbFlY1uQ/PZWsrd3b7Y/uYcrbu5/xUfnH8+7vl2rdL28Z/KBtYUX1WHJZ0Pwf/e9Xf+98eH6rFLVuY/WI/9f7Fu5ULJKYwtwItwsqN7qYzL35zW3AzO2x0R/7h19m8OCnM9mnBwtwGy/3vuJk5YQ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9WhEaV2w+DtlxbQ6QZX0HMSts0T9b2ZZdac9t49bsql3i2u59vfv45kcrQuN6BxXnZYlDe4L+28av2VWTjiKPn9bnA1tKcUZaPyiu97Yp1+yaaT3cAISJgTAxECYGwsRAmBgIEwNhYiBMDISJgTAxxidsM7Mn5RovRtmr8OaLzedX82b711f/wuEuHbpX5vNISzqI8QkrWk/z7p7sNY+78ly4EXQQtvnzYbL1gAsQ8RitsM2PX++W6+q+Fnfi3F7yKIrvz5vPLz9+/fBDdm/+KU+pf7ft7uVPj/bt7pf+V3DiMV5hH33fly/83+LQ8Iwa/6WZpryK7S6pvnxa+isqA66iR2O8woymtbvEtK4uodmP8ywzBl/Ml75L9Jd3N+79S/m2/403ERm3MN8TVhcSfZeYIyw5KmGmy9s9Lfzfokw6to8NwsousXzb95aAqIxaWHGcdPjL8Auvxpi7f9nf8eKTDv+WpEMA0no1DuMWB85wSRAmBsLEQJgYCBMDYWIgTAyEiYEwMRAmBsLEQJgYCBMDYWIgTIz/AwgpoPQ2GR2LAAAAAElFTkSuQmCC" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r"># col: select a color for the plotting characters
plot(x = trees$Girth, y = trees$Volume, pch = 19, main = &quot;Girth vs. Volume for Black Cherry Trees&quot;,
xlab = &quot;Tree Girth (in)&quot;, ylab = &quot;Tree Volume (cu ft)&quot;, las = 1, col = &quot;blue&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAnFBMVEUAAAAAADoAAGYAAP8AOjoAOmYAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6ZmY6ZrY6kNtmAABmADpmAGZmOgBmOpBmZjpmZrZmkJBmtrZmtttmtv+QOgCQOjqQOmaQkGaQtpCQ2/+2ZgC2Zjq2Zma2kDq225C2/7a2///bkDrb25Db/7bb/9vb////tmb/25D/29v//7b//9v////hp7/1AAA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rAAAAAElFTkSuQmCC" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r"># We can use the c() function to make a vector and have several colors, plotting
# characters, etc. per plot.
plot(x = trees$Girth, y = trees$Volume, pch = 19, main = &quot;Girth vs. Volume for Black Cherry Trees&quot;,
xlab = &quot;Tree Girth (in)&quot;, ylab = &quot;Tree Volume (cu ft)&quot;, las = 1, col = c(&quot;black&quot;,
&quot;blue&quot;))
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAnFBMVEUAAAAAADoAAGYAAP8AOjoAOmYAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6ZmY6ZrY6kNtmAABmADpmAGZmOgBmOpBmZjpmZrZmkJBmtrZmtttmtv+QOgCQOjqQOmaQkGaQtpCQ2/+2ZgC2Zjq2Zma2kDq225C2/7a2///bkDrb25Db/7bb/9vb////tmb/25D/29v//7b//9v////hp7/1AAAACXBIWXMAAAsSAAALEgHS3X78AAAMl0lEQVR4nO2de2ObyBVHid1aSnbTyk263VbObk36kLxrqRLf/7t1HiAhG9CABJofnPOHowdXAg4zc8XATZINxXb+8Gr/+bTKdo93q/1TkiR//Gr+zNxD869bbJOYxXaPH553j/ZFF+PYP314Nh9ilkrzxf3H3NnPe3jdJAXmBb/Ewoe5Tyli8qfmDRuduVD7qPg2vy72+d1qnSxLa75/WmbHNS2+wX/e7+7vv83yqVnJ0vaefPviGPZ248JJOgtI4AZcIqzl8ht7YNp24A9f12DsIbf0bcce6m65tTkA7avuILSNoMAs8bttT+6DzGLLNy2saHIfnvPWlh/s9sMOMfnXuo/zS/nV8c/vVhvfLm0b/yFvYFnxWnZc08M3+M8r/j789jgrVjdvYfaNw9KHB+82LpAhhbkNqBGW73S3nHnwm9uD2/lxpzvSD/+cL7JGYbZPCxbmdljqP8d9mRM2y9897tFyl3jaAZ8Ky9Z+BUvbWyfs/caF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oTGZduPXQ5cmwMkSdtBzApbts9WdnlX2nLfuC3rtUvc2KOvdR9ffWtFaFzroOyyLLFrT9B+3/gt6zXpyNLh0/q0Y0vJLkjrO8W13jf5lvWZ1sMNQJgYCBMDYWIgTAyEiYEwMRAmBsLEQJgYCBNjfMK2c3tSrnIyys7Cmze2n1/Nk91fX/0Dh5s6dI/M6wOtaSfGJyyrPc27f7JzHnf5uXAj6Chs++fjYpsOExDDMVph2x+/3q02xXUt7sS5nfLIsu/P288vP3798EPyYP7JT6l/t+3u5U+P9un+l/YzOMMxXmEffd+XLv3f7NjwjBr/plkmn8V2U6ovn1Z+RqXDLPpgjFeY0bRxU0ybYgrNvpwmiTH4Yt70XaKf3t265y/50/YX3gzIuIX5nrCYSPRdYoqw6CiEmS5v/7T0f7M86dg9VgjLu8T8adtLAgZl1MKy06TDT8MvvRpj7uHlcMWLTzr8U5IOAUjr1TiOW/xwhmuCMDEQJgbCxECYGAgTA2FiIEwMhImBMDEQJgbCxECYGAgTA2Fi/B/C83JyK0tfRQAAAABJRU5ErkJggg==" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r">plot(x = trees$Girth, y = trees$Volume, pch = c(1, 19), main = &quot;Girth vs. Volume for Black Cherry Trees&quot;,
xlab = &quot;Tree Girth (in)&quot;, ylab = &quot;Tree Volume (cu ft)&quot;, las = 1, col = &quot;blue&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAnFBMVEUAAAAAADoAAGYAAP8AOjoAOmYAOpAAZrY6AAA6ADo6AGY6OgA6OmY6OpA6ZmY6ZrY6kNtmAABmADpmAGZmOgBmOpBmZjpmZrZmkJBmtrZmtttmtv+QOgCQOjqQOmaQkGaQtpCQ2/+2ZgC2Zjq2Zma2kDq225C2/7a2///bkDrb25Db/7bb/9vb////tmb/25D/29v//7b//9v////hp7/1AAAACXBIWX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8X/Y447+CwmO6gAAAABJRU5ErkJggg==" title="plot of chunk unnamed-chunk-1" alt="plot of chunk unnamed-chunk-1" style="display: block; margin: auto;" /></p>
<pre><code class="r">### Those different colors and plotting characters that we just saw were arbitrary.
### The 2-element vector of colors or plotting characters just repeats for the
### whole data frame. What if we want to have more meaningful coloration, with a
### different color for each group?
### We&#39;ll use the iris dataset to illustrate one way to do this. This dataframe
### describes the sepal length, sepal width, petal length, petal width, and species
### for 150 different irises.
# First look at the data:
iris
</code></pre>
<pre><code>## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
## 7 4.6 3.4 1.4 0.3 setosa
## 8 5.0 3.4 1.5 0.2 setosa
## 9 4.4 2.9 1.4 0.2 setosa
## 10 4.9 3.1 1.5 0.1 setosa
## 11 5.4 3.7 1.5 0.2 setosa
## 12 4.8 3.4 1.6 0.2 setosa
## 13 4.8 3.0 1.4 0.1 setosa
## 14 4.3 3.0 1.1 0.1 setosa
## 15 5.8 4.0 1.2 0.2 setosa
## 16 5.7 4.4 1.5 0.4 setosa
## 17 5.4 3.9 1.3 0.4 setosa
## 18 5.1 3.5 1.4 0.3 setosa
## 19 5.7 3.8 1.7 0.3 setosa
## 20 5.1 3.8 1.5 0.3 setosa
## 21 5.4 3.4 1.7 0.2 setosa
## 22 5.1 3.7 1.5 0.4 setosa
## 23 4.6 3.6 1.0 0.2 setosa
## 24 5.1 3.3 1.7 0.5 setosa
## 25 4.8 3.4 1.9 0.2 setosa
## 26 5.0 3.0 1.6 0.2 setosa
## 27 5.0 3.4 1.6 0.4 setosa
## 28 5.2 3.5 1.5 0.2 setosa
## 29 5.2 3.4 1.4 0.2 setosa
## 30 4.7 3.2 1.6 0.2 setosa
## 31 4.8 3.1 1.6 0.2 setosa
## 32 5.4 3.4 1.5 0.4 setosa
## 33 5.2 4.1 1.5 0.1 setosa
## 34 5.5 4.2 1.4 0.2 setosa
## 35 4.9 3.1 1.5 0.2 setosa
## 36 5.0 3.2 1.2 0.2 setosa
## 37 5.5 3.5 1.3 0.2 setosa
## 38 4.9 3.6 1.4 0.1 setosa
## 39 4.4 3.0 1.3 0.2 setosa
## 40 5.1 3.4 1.5 0.2 setosa
## 41 5.0 3.5 1.3 0.3 setosa
## 42 4.5 2.3 1.3 0.3 setosa
## 43 4.4 3.2 1.3 0.2 setosa
## 44 5.0 3.5 1.6 0.6 setosa
## 45 5.1 3.8 1.9 0.4 setosa
## 46 4.8 3.0 1.4 0.3 setosa
## 47 5.1 3.8 1.6 0.2 setosa
## 48 4.6 3.2 1.4 0.2 setosa
## 49 5.3 3.7 1.5 0.2 setosa
## 50 5.0 3.3 1.4 0.2 setosa
## 51 7.0 3.2 4.7 1.4 versicolor
## 52 6.4 3.2 4.5 1.5 versicolor
## 53 6.9 3.1 4.9 1.5 versicolor
## 54 5.5 2.3 4.0 1.3 versicolor
## 55 6.5 2.8 4.6 1.5 versicolor
## 56 5.7 2.8 4.5 1.3 versicolor
## 57 6.3 3.3 4.7 1.6 versicolor
## 58 4.9 2.4 3.3 1.0 versicolor
## 59 6.6 2.9 4.6 1.3 versicolor
## 60 5.2 2.7 3.9 1.4 versicolor
## 61 5.0 2.0 3.5 1.0 versicolor
## 62 5.9 3.0 4.2 1.5 versicolor
## 63 6.0 2.2 4.0 1.0 versicolor
## 64 6.1 2.9 4.7 1.4 versicolor
## 65 5.6 2.9 3.6 1.3 versicolor
## 66 6.7 3.1 4.4 1.4 versicolor
## 67 5.6 3.0 4.5 1.5 versicolor
## 68 5.8 2.7 4.1 1.0 versicolor
## 69 6.2 2.2 4.5 1.5 versicolor
## 70 5.6 2.5 3.9 1.1 versicolor
## 71 5.9 3.2 4.8 1.8 versicolor
## 72 6.1 2.8 4.0 1.3 versicolor
## 73 6.3 2.5 4.9 1.5 versicolor
## 74 6.1 2.8 4.7 1.2 versicolor
## 75 6.4 2.9 4.3 1.3 versicolor
## 76 6.6 3.0 4.4 1.4 versicolor
## 77 6.8 2.8 4.8 1.4 versicolor
## 78 6.7 3.0 5.0 1.7 versicolor
## 79 6.0 2.9 4.5 1.5 versicolor
## 80 5.7 2.6 3.5 1.0 versicolor
## 81 5.5 2.4 3.8 1.1 versicolor
## 82 5.5 2.4 3.7 1.0 versicolor
## 83 5.8 2.7 3.9 1.2 versicolor
## 84 6.0 2.7 5.1 1.6 versicolor
## 85 5.4 3.0 4.5 1.5 versicolor
## 86 6.0 3.4 4.5 1.6 versicolor
## 87 6.7 3.1 4.7 1.5 versicolor
## 88 6.3 2.3 4.4 1.3 versicolor
## 89 5.6 3.0 4.1 1.3 versicolor
## 90 5.5 2.5 4.0 1.3 versicolor
## 91 5.5 2.6 4.4 1.2 versicolor
## 92 6.1 3.0 4.6 1.4 versicolor
## 93 5.8 2.6 4.0 1.2 versicolor
## 94 5.0 2.3 3.3 1.0 versicolor
## 95 5.6 2.7 4.2 1.3 versicolor
## 96 5.7 3.0 4.2 1.2 versicolor
## 97 5.7 2.9 4.2 1.3 versicolor
## 98 6.2 2.9 4.3 1.3 versicolor
## 99 5.1 2.5 3.0 1.1 versicolor
## 100 5.7 2.8 4.1 1.3 versicolor
## 101 6.3 3.3 6.0 2.5 virginica
## 102 5.8 2.7 5.1 1.9 virginica
## 103 7.1 3.0 5.9 2.1 virginica
## 104 6.3 2.9 5.6 1.8 virginica
## 105 6.5 3.0 5.8 2.2 virginica
## 106 7.6 3.0 6.6 2.1 virginica
## 107 4.9 2.5 4.5 1.7 virginica
## 108 7.3 2.9 6.3 1.8 virginica
## 109 6.7 2.5 5.8 1.8 virginica
## 110 7.2 3.6 6.1 2.5 virginica
## 111 6.5 3.2 5.1 2.0 virginica
## 112 6.4 2.7 5.3 1.9 virginica
## 113 6.8 3.0 5.5 2.1 virginica
## 114 5.7 2.5 5.0 2.0 virginica
## 115 5.8 2.8 5.1 2.4 virginica
## 116 6.4 3.2 5.3 2.3 virginica
## 117 6.5 3.0 5.5 1.8 virginica
## 118 7.7 3.8 6.7 2.2 virginica
## 119 7.7 2.6 6.9 2.3 virginica
## 120 6.0 2.2 5.0 1.5 virginica
## 121 6.9 3.2 5.7 2.3 virginica
## 122 5.6 2.8 4.9 2.0 virginica
## 123 7.7 2.8 6.7 2.0 virginica
## 124 6.3 2.7 4.9 1.8 virginica
## 125 6.7 3.3 5.7 2.1 virginica
## 126 7.2 3.2 6.0 1.8 virginica
## 127 6.2 2.8 4.8 1.8 virginica
## 128 6.1 3.0 4.9 1.8 virginica
## 129 6.4 2.8 5.6 2.1 virginica
## 130 7.2 3.0 5.8 1.6 virginica
## 131 7.4 2.8 6.1 1.9 virginica
## 132 7.9 3.8 6.4 2.0 virginica
## 133 6.4 2.8 5.6 2.2 virginica
## 134 6.3 2.8 5.1 1.5 virginica
## 135 6.1 2.6 5.6 1.4 virginica
## 136 7.7 3.0 6.1 2.3 virginica
## 137 6.3 3.4 5.6 2.4 virginica
## 138 6.4 3.1 5.5 1.8 virginica
## 139 6.0 3.0 4.8 1.8 virginica
## 140 6.9 3.1 5.4 2.1 virginica
## 141 6.7 3.1 5.6 2.4 virginica
## 142 6.9 3.1 5.1 2.3 virginica
## 143 5.8 2.7 5.1 1.9 virginica
## 144 6.8 3.2 5.9 2.3 virginica
## 145 6.7 3.3 5.7 2.5 virginica
## 146 6.7 3.0 5.2 2.3 virginica
## 147 6.3 2.5 5.0 1.9 virginica
## 148 6.5 3.0 5.2 2.0 virginica
## 149 6.2 3.4 5.4 2.3 virginica
## 150 5.9 3.0 5.1 1.8 virginica
</code></pre>
<pre><code class="r">head(iris)
</code></pre>
<pre><code>## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
</code></pre>
<pre><code class="r">dim(iris)
</code></pre>
<pre><code>## [1] 150 5
</code></pre>
<pre><code class="r">str(iris)
</code></pre>
<pre><code>## &#39;data.frame&#39;: 150 obs. of 5 variables:
## $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
## $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
## $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
## $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
## $ Species : Factor w/ 3 levels &quot;setosa&quot;,&quot;versicolor&quot;,..: 1 1 1 1 1 1 1 1 1 1 ...
</code></pre>
<pre><code class="r"># We can extend the idea of passing a vector of colors to the col= argument in
# the plot() function call.
# Let&#39;s cheat first, and see what the finished product will look like. First I
# define a new object with the three colors that I want to use.
plot.colors &lt;- c(&quot;violet&quot;, &quot;purple&quot;, &quot;blue&quot;)
plot.colors
</code></pre>
<pre><code>## [1] &quot;violet&quot; &quot;purple&quot; &quot;blue&quot;
</code></pre>
<pre><code class="r"># Here&#39;s the cheating bit: I just looked at this dataframe and saw that there are
# exactly 50 observations for each species.
iris
</code></pre>
<pre><code>## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
## 7 4.6 3.4 1.4 0.3 setosa
## 8 5.0 3.4 1.5 0.2 setosa
## 9 4.4 2.9 1.4 0.2 setosa
## 10 4.9 3.1 1.5 0.1 setosa
## 11 5.4 3.7 1.5 0.2 setosa
## 12 4.8 3.4 1.6 0.2 setosa
## 13 4.8 3.0 1.4 0.1 setosa
## 14 4.3 3.0 1.1 0.1 setosa
## 15 5.8 4.0 1.2 0.2 setosa
## 16 5.7 4.4 1.5 0.4 setosa
## 17 5.4 3.9 1.3 0.4 setosa
## 18 5.1 3.5 1.4 0.3 setosa
## 19 5.7 3.8 1.7 0.3 setosa
## 20 5.1 3.8 1.5 0.3 setosa
## 21 5.4 3.4 1.7 0.2 setosa
## 22 5.1 3.7 1.5 0.4 setosa
## 23 4.6 3.6 1.0 0.2 setosa
## 24 5.1 3.3 1.7 0.5 setosa
## 25 4.8 3.4 1.9 0.2 setosa
## 26 5.0 3.0 1.6 0.2 setosa
## 27 5.0 3.4 1.6 0.4 setosa
## 28 5.2 3.5 1.5 0.2 setosa
## 29 5.2 3.4 1.4 0.2 setosa
## 30 4.7 3.2 1.6 0.2 setosa
## 31 4.8 3.1 1.6 0.2 setosa
## 32 5.4 3.4 1.5 0.4 setosa
## 33 5.2 4.1 1.5 0.1 setosa
## 34 5.5 4.2 1.4 0.2 setosa
## 35 4.9 3.1 1.5 0.2 setosa
## 36 5.0 3.2 1.2 0.2 setosa
## 37 5.5 3.5 1.3 0.2 setosa
## 38 4.9 3.6 1.4 0.1 setosa
## 39 4.4 3.0 1.3 0.2 setosa
## 40 5.1 3.4 1.5 0.2 setosa
## 41 5.0 3.5 1.3 0.3 setosa
## 42 4.5 2.3 1.3 0.3 setosa
## 43 4.4 3.2 1.3 0.2 setosa
## 44 5.0 3.5 1.6 0.6 setosa
## 45 5.1 3.8 1.9 0.4 setosa
## 46 4.8 3.0 1.4 0.3 setosa
## 47 5.1 3.8 1.6 0.2 setosa
## 48 4.6 3.2 1.4 0.2 setosa
## 49 5.3 3.7 1.5 0.2 setosa
## 50 5.0 3.3 1.4 0.2 setosa
## 51 7.0 3.2 4.7 1.4 versicolor
## 52 6.4 3.2 4.5 1.5 versicolor
## 53 6.9 3.1 4.9 1.5 versicolor
## 54 5.5 2.3 4.0 1.3 versicolor
## 55 6.5 2.8 4.6 1.5 versicolor
## 56 5.7 2.8 4.5 1.3 versicolor
## 57 6.3 3.3 4.7 1.6 versicolor
## 58 4.9 2.4 3.3 1.0 versicolor
## 59 6.6 2.9 4.6 1.3 versicolor
## 60 5.2 2.7 3.9 1.4 versicolor
## 61 5.0 2.0 3.5 1.0 versicolor
## 62 5.9 3.0 4.2 1.5 versicolor
## 63 6.0 2.2 4.0 1.0 versicolor
## 64 6.1 2.9 4.7 1.4 versicolor
## 65 5.6 2.9 3.6 1.3 versicolor
## 66 6.7 3.1 4.4 1.4 versicolor
## 67 5.6 3.0 4.5 1.5 versicolor
## 68 5.8 2.7 4.1 1.0 versicolor
## 69 6.2 2.2 4.5 1.5 versicolor
## 70 5.6 2.5 3.9 1.1 versicolor
## 71 5.9 3.2 4.8 1.8 versicolor
## 72 6.1 2.8 4.0 1.3 versicolor
## 73 6.3 2.5 4.9 1.5 versicolor
## 74 6.1 2.8 4.7 1.2 versicolor
## 75 6.4 2.9 4.3 1.3 versicolor
## 76 6.6 3.0 4.4 1.4 versicolor
## 77 6.8 2.8 4.8 1.4 versicolor
## 78 6.7 3.0 5.0 1.7 versicolor
## 79 6.0 2.9 4.5 1.5 versicolor
## 80 5.7 2.6 3.5 1.0 versicolor
## 81 5.5 2.4 3.8 1.1 versicolor
## 82 5.5 2.4 3.7 1.0 versicolor
## 83 5.8 2.7 3.9 1.2 versicolor
## 84 6.0 2.7 5.1 1.6 versicolor
## 85 5.4 3.0 4.5 1.5 versicolor
## 86 6.0 3.4 4.5 1.6 versicolor
## 87 6.7 3.1 4.7 1.5 versicolor
## 88 6.3 2.3 4.4 1.3 versicolor
## 89 5.6 3.0 4.1 1.3 versicolor
## 90 5.5 2.5 4.0 1.3 versicolor
## 91 5.5 2.6 4.4 1.2 versicolor
## 92 6.1 3.0 4.6 1.4 versicolor
## 93 5.8 2.6 4.0 1.2 versicolor
## 94 5.0 2.3 3.3 1.0 versicolor
## 95 5.6 2.7 4.2 1.3 versicolor
## 96 5.7 3.0 4.2 1.2 versicolor
## 97 5.7 2.9 4.2 1.3 versicolor
## 98 6.2 2.9 4.3 1.3 versicolor
## 99 5.1 2.5 3.0 1.1 versicolor
## 100 5.7 2.8 4.1 1.3 versicolor
## 101 6.3 3.3 6.0 2.5 virginica
## 102 5.8 2.7 5.1 1.9 virginica
## 103 7.1 3.0 5.9 2.1 virginica
## 104 6.3 2.9 5.6 1.8 virginica
## 105 6.5 3.0 5.8 2.2 virginica
## 106 7.6 3.0 6.6 2.1 virginica
## 107 4.9 2.5 4.5 1.7 virginica
## 108 7.3 2.9 6.3 1.8 virginica
## 109 6.7 2.5 5.8 1.8 virginica
## 110 7.2 3.6 6.1 2.5 virginica
## 111 6.5 3.2 5.1 2.0 virginica
## 112 6.4 2.7 5.3 1.9 virginica
## 113 6.8 3.0 5.5 2.1 virginica
## 114 5.7 2.5 5.0 2.0 virginica
## 115 5.8 2.8 5.1 2.4 virginica
## 116 6.4 3.2 5.3 2.3 virginica
## 117 6.5 3.0 5.5 1.8 virginica
## 118 7.7 3.8 6.7 2.2 virginica
## 119 7.7 2.6 6.9 2.3 virginica
## 120 6.0 2.2 5.0 1.5 virginica
## 121 6.9 3.2 5.7 2.3 virginica
## 122 5.6 2.8 4.9 2.0 virginica
## 123 7.7 2.8 6.7 2.0 virginica
## 124 6.3 2.7 4.9 1.8 virginica
## 125 6.7 3.3 5.7 2.1 virginica
## 126 7.2 3.2 6.0 1.8 virginica
## 127 6.2 2.8 4.8 1.8 virginica
## 128 6.1 3.0 4.9 1.8 virginica
## 129 6.4 2.8 5.6 2.1 virginica
## 130 7.2 3.0 5.8 1.6 virginica
## 131 7.4 2.8 6.1 1.9 virginica
## 132 7.9 3.8 6.4 2.0 virginica
## 133 6.4 2.8 5.6 2.2 virginica
## 134 6.3 2.8 5.1 1.5 virginica
## 135 6.1 2.6 5.6 1.4 virginica
## 136 7.7 3.0 6.1 2.3 virginica
## 137 6.3 3.4 5.6 2.4 virginica
## 138 6.4 3.1 5.5 1.8 virginica
## 139 6.0 3.0 4.8 1.8 virginica
## 140 6.9 3.1 5.4 2.1 virginica
## 141 6.7 3.1 5.6 2.4 virginica
## 142 6.9 3.1 5.1 2.3 virginica
## 143 5.8 2.7 5.1 1.9 virginica
## 144 6.8 3.2 5.9 2.3 virginica
## 145 6.7 3.3 5.7 2.5 virginica
## 146 6.7 3.0 5.2 2.3 virginica
## 147 6.3 2.5 5.0 1.9 virginica
## 148 6.5 3.0 5.2 2.0 virginica
## 149 6.2 3.4 5.4 2.3 virginica
## 150 5.9 3.0 5.1 1.8 virginica
</code></pre>
<pre><code class="r"># I use the repeat function, rep() and the each= argument, to create a new vector
# with each element of plot.colors repeated 50 times in turn.
color.vector &lt;- rep(x = plot.colors, each = 50)
color.vector
</code></pre>
<pre><code>## [1] &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot;
## [8] &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot;
## [15] &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot;
## [22] &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot;
## [29] &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot;
## [36] &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot;
## [43] &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot; &quot;violet&quot;
## [50] &quot;violet&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot;
## [57] &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot;
## [64] &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot;
## [71] &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot;
## [78] &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot;
## [85] &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot;
## [92] &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot; &quot;purple&quot;
## [99] &quot;purple&quot; &quot;purple&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot;
## [106] &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot;
## [113] &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot;
## [120] &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot;
## [127] &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot;
## [134] &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot;
## [141] &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot; &quot;blue&quot;
## [148] &quot;blue&quot; &quot;blue&quot; &quot;blue&quot;
</code></pre>
<pre><code class="r">plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, col = color.vector)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAk1BMVEUAAAAAADoAAGYAAP8AOjoAOpAAZmYAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtmAABmADpmAGZmOgBmOpBmZgBmZjpmkJBmtttmtv+QOgCQOjqQOmaQkDqQ2/+gIPC2ZgC2kDq225C2/7a2///bkDrbtmbb25Db/7bb/9vb///ugu7/tmb/25D/29v//7b//9v////GVL0zAAAACXBIWXMAAAsSAAALEgHS3X78AAANKklEQVR4nO2dDXubOBZGaVKv09msk9mP1u6sw2zjaeuQ2v7/v275sIkIBgsMQi+c8zzToTaqk5xI9wqJS3AAKYL2LWEArhHWuiW0xkbYJgjm6UEUBMtCW3COhbDX++1+lYjaPa5ff3s224JzLIV9XZsHh2P86vlrgzPYDImvdx9STVE8MIbGmIiwAbAQFs2OQyLCPMBC2GaRuSoMiVlbcI5dDzuEsTSSDh+wiWFhktbvfn8mrfcAJs5iIEwMhHnA7e2t9bkIG57b2wbGEDY8CBMDYWoQw0YMwsRAmBgIEwNhYiBMDISJgTAxECYGwsRAmBgIEwNhYiBMDIQ5x2YxxTjn3ekIc43NcqVxzvvTEeYahImBMDWIYZMCYWIgTAyEiYEwMRDmGZdySIT5xcVZGsL8AmFiIEwNYtjIQJgYCBMDYWLYlC5KCrcllXCSCis3VMIZFrsellUsKhSaOiBsEOyEZTXczEJT1EscCCthr/fb5H/Rx7tjLdlTW3COlbC0llvMr+1hQ73EYbERlhRyO7FZmG3BOVYlZLMRMa1ySQ8bGBthaTnSpJuFx/Q+bwvOYeIsBsLEQJhzmlSWKoMw1zSq3VYGYa5BmBgIU4MYNikQJgbCxECYGAgblOYJCMKGpEWKj7AhQZgYCFODGDZ6ECYGwsRAmBgIEwNhfWMmgukxyyteY061bnPa/3sI6xmEiYEwNYhh0wZhYiBMDISJgTA3XJdpGCD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xECYGwsQYlbDsIml+qTRM1uRf74Lgw3FFYPevrXGieUnVJD6r6i0PGJWwItHsry+rZfKzj2bZzz/3UCssfh1hbni9//73f9787/7nKrkwHs2jZaYl/i+Ke9t+Fcy26VYYU1iUvvCPh2Q5OApu/vslPiv+Z1qvDvfM2IR9Wsd//jU/PqFulsqKe9j3+2S5N+s78VuGsNfsnd+e45d3j+vdQ3rWp/UVmx56ZWzC0v70/bh7Ivp8t8xiWJSuu6W97S7+qyEsf2f/df1qaL1if1SvjFJYqiUeDqPlZnHUMs/e30Y3ST8yhZ3eQZh7TsL+TFbjF5s4hoVHYfEYt08TkNhPVOhh+TuxobchEWFOyHtYnNDPttmuYjO12D3MfjwEf0uc/IgDWTxYxi9Gx7MSQ3HS8e9lfNZ3hA1C1HzPi6+eckYtrCm7h2v29bgBYWIgTAyEiYEwMRAmBsLEQJgYCBMDYWIgTAyEiYEwMRAmBsLEQJgY/we7Jgrqp1s+iAAAAABJRU5ErkJggg==" title="plot of chunk Plotting by group" alt="plot of chunk Plotting by group" style="display: block; margin: auto;" /></p>
<pre><code class="r"># Notice the lengths of the x-vector, the y-vector, and the color vector are all
# the same.
length(iris$Petal.Length)
</code></pre>
<pre><code>## [1] 150
</code></pre>
<pre><code class="r">length(iris$Sepal.Length)
</code></pre>
<pre><code>## [1] 150
</code></pre>
<pre><code class="r">length(color.vector)
</code></pre>
<pre><code>## [1] 150
</code></pre>
<pre><code class="r"># What if we want to automate the process? We can take advantage of the fact that
# the Species column is a factor.
head(iris)
</code></pre>
<pre><code>## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
</code></pre>
<pre><code class="r">iris$Species
</code></pre>
<pre><code>## [1] setosa setosa setosa setosa setosa setosa
## [7] setosa setosa setosa setosa setosa setosa
## [13] setosa setosa setosa setosa setosa setosa
## [19] setosa setosa setosa setosa setosa setosa
## [25] setosa setosa setosa setosa setosa setosa
## [31] setosa setosa setosa setosa setosa setosa
## [37] setosa setosa setosa setosa setosa setosa
## [43] setosa setosa setosa setosa setosa setosa
## [49] setosa setosa versicolor versicolor versicolor versicolor
## [55] versicolor versicolor versicolor versicolor versicolor versicolor
## [61] versicolor versicolor versicolor versicolor versicolor versicolor
## [67] versicolor versicolor versicolor versicolor versicolor versicolor
## [73] versicolor versicolor versicolor versicolor versicolor versicolor
## [79] versicolor versicolor versicolor versicolor versicolor versicolor
## [85] versicolor versicolor versicolor versicolor versicolor versicolor
## [91] versicolor versicolor versicolor versicolor versicolor versicolor
## [97] versicolor versicolor versicolor versicolor virginica virginica
## [103] virginica virginica virginica virginica virginica virginica
## [109] virginica virginica virginica virginica virginica virginica
## [115] virginica virginica virginica virginica virginica virginica
## [121] virginica virginica virginica virginica virginica virginica
## [127] virginica virginica virginica virginica virginica virginica
## [133] virginica virginica virginica virginica virginica virginica
## [139] virginica virginica virginica virginica virginica virginica
## [145] virginica virginica virginica virginica virginica virginica
## Levels: setosa versicolor virginica
</code></pre>
<pre><code class="r">str(iris)
</code></pre>
<pre><code>## &#39;data.frame&#39;: 150 obs. of 5 variables:
## $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
## $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
## $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
## $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
## $ Species : Factor w/ 3 levels &quot;setosa&quot;,&quot;versicolor&quot;,..: 1 1 1 1 1 1 1 1 1 1 ...
</code></pre>
<pre><code class="r">as.numeric(iris$Species)
</code></pre>
<pre><code>## [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [36] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [71] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3
## [106] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
## [141] 3 3 3 3 3 3 3 3 3 3
</code></pre>
<pre><code class="r">plot.colors &lt;- c(&quot;violet&quot;, &quot;purple&quot;, &quot;blue&quot;)
color.vector &lt;- plot.colors[iris$Species]
###dev.off() # Just clearing the present plots
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, col = color.vector,
main = &quot;Iris sepal length vs. petal length&quot;, xlab = &quot;Petal length&quot;, ylab = &quot;Sepal length&quot;,
las = 1)
#### Let&#39;s add a legend -----------
# We use the legend() function to add a legend to an existing plot
legend(&quot;topleft&quot;, pch = 19, col = plot.colors, legend = unique(iris$Species))
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAApVBMVEUAAAAAADoAAGYAAP8AOjoAOmYAOpAAZmYAZpAAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtmAABmADpmAGZmOgBmOjpmOpBmZgBmZjpmkJBmtttmtv+QOgCQOjqQOmaQZgCQkDqQkGaQtpCQ2/+gIPC2ZgC2tma225C2/7a2///bkDrbtmbb25Db/7bb/9vb///ugu7/tmb/25D/29v//7b//9v///90uif0AAAACXBIWXMAAAsSAAALEgHS3X78AAAQC0lEQVR4nO2dC5ubuBWGmSTr1k7W9STpZdcz3XYd2oybxIPX5v//tCKJizAXSyAEH3zv8yTDYAQeXoOOLhwH8fhcHt+8XJ+CIFh9T5Yuj4FYPKlX0uVQ/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CC" title="plot of chunk Plotting by group" alt="plot of chunk Plotting by group" style="display: block; margin: auto;" /></p>
<pre><code class="r"># You can customize the legend if you wish.
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, col = color.vector,
main = &quot;Iris sepal length vs. petal length&quot;, xlab = &quot;Petal length&quot;, ylab = &quot;Sepal length&quot;,
las = 1)
# Here I pass a character vector to the legend= argument so that I can include
# the first letter of the species name The bty=&#39;n&#39; argument suppresses the border
# around the legend. (A personal preference)
legend(&quot;topleft&quot;, pch = 19, col = plot.colors, legend = c(&quot;I. setosa&quot;, &quot;I. versicolor&quot;,
&quot;I. virginica&quot;), bty = &quot;n&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAApVBMVEUAAAAAADoAAGYAAP8AOjoAOmYAOpAAZmYAZpAAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtmAABmADpmAGZmOgBmOjpmOpBmZgBmZjpmkJBmtttmtv+QOgCQOjqQOmaQZgCQkDqQkGaQtpCQ2/+gIPC2ZgC2tma225C2/7a2///bkDrbtmbb25Db/7bb/9vb///ugu7/tmb/25D/29v//7b//9v///90uif0AAAACXBIWXMAAAsSAAALEgHS3X78AAAPzElEQVR4nO2dC5ubuBWGmSTr1s6uayfby65nuu06tImbjQfH9v//aUUXQBiDJUCCD773eZJhMDIzvEY6unAmug7Pefvmy+U5iqLFH+nWeRuJzaN6RW/H4mu0ucrDxJ7sFVE2e4/bo5Zq491q8U18Xea7BYl42/P2aW+eT5CfIns7uWPZ+YQ9EbUvSQagi7DWJW9Rd9jTXm3Jj7L6FF+z7UT9tE/7y7N45ZB+qOVr4ujiA28clb7Zebs4JuLTLTbSe2F3zXfL9xZvIvaa5xPkp8jfTh7W/YR9YCPsUFQi8ucuyvZFWdj1tFKXSaC3q8LkC/XXL9157/rp3fqssga+ls53rRXW/YR9YCHstD5enuUH7MP+9GPxQfQnTBAbn410+7TSv3Ta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QWFgUBgYFAYGhYFBYWBQGBg9CROpjdpweY7ynH6uxFG0e3xUDWaaM8eTvmn3q4o0a+1+1VJ+tn6Enbctf4vDMnXW7rIny9YfkzzLqjO3aVldTrk+tv1VzeyivQi7/PNz60vX/sPe/r7Os6w6c5uW1YH2v2ZKnJseuErsVPTQukrMsqw6Y6ZldST+pXVRcXdmm4MLO39oXcmYHzwniiyrztykZXUgXhzb/rzXuPhphxZ2et/BV9tqptSKhzqpkNWyqHl1BxbWoU0QGVLbfmJbX7rbtKyORdvXCPn2wMLiDp/1uMNd0iWsb3vSQ+uiidH2seMMBoWBQWFgUBgYFAYGhYFBYWBQGBgUBgaFgUFhYExW2GkVRU96JuD8Nz14KkdRzaHUjPSIe7tHyHSFpdc/WRzz7WLjnpl0H4UNi7j+6b8kipaX52hxlEtgMmGJ/OYvWzEFnERv/vVresTXn35uPSMckEkLSxZf12KaV90/549ftDC998cv6a7zh/15K494v++w0CEY0xUm27BEzrfJu22VfquF/S/be3mRuzKlHdZEBWO6wmSTpKb+RCX4RtxLmbBsL4WNByUsrecuz0JHai7J77Cv2d7UUFElUtig6KBPhhfn7eKPbfQn6cUIOpShNOj4+y494iuFoYDgKWf2ws7bLmt5wjN7YWhQGBgUBgaFgUFhYFAYGBQGBoWBQWFgUBgYFAYGhYFBYWBQGBgUBsb/AY6gDXrEZUZzAAAAAElFTkSuQmCC" title="plot of chunk Plotting by group" alt="plot of chunk Plotting by group" style="display: block; margin: auto;" /></p>
<pre><code class="r"># Italicize the labels in the legend using text.font=3
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, col = color.vector,
main = &quot;Iris sepal length vs. petal length&quot;, xlab = &quot;Petal length&quot;, ylab = &quot;Sepal length&quot;,
las = 1)
legend(&quot;topleft&quot;, pch = 19, col = plot.colors, legend = c(&quot;I. setosa&quot;, &quot;I. versicolor&quot;,
&quot;I. virginica&quot;), bty = &quot;n&quot;, text.font = 3)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KG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1qNNkBlSu35iO1+667SsjkW73xGK7ZGFxT0+63GPWtInrO960qRz0dRo+9hxBoPCwKAwMCgMDAoDg8LAoDAwKAwMCgODwsCgMDBmK+z1KYoespmA06ds8FSNoppDqTniiFu7J8h8hYnrn66OxXa5ccuM2Edh4yKvv/g/jaL1eR+tjmoJTC4sVd982Mop4DR6/Pdv4ojvf/t75xnhgMxaWLr6/l5O8+r6c/r4LROW7X33Tew6PR9OW3XEL4ceCx2CMV9hqg1L1Xybqm1P4ttM2B/53vNntStX2mNNVDDmK0w1SXrqT94EH2VdyoXleylsOmhh4j533ksdwlxa1LDv+V5hqLwlUtioZEGfCi9O29Wf2+gvyosRdGhDIuj4504c8Z3CUEDwVLB4Yadtn7U84Vm8MDQoDAwKA4PCwKAwMCgMDAoDg8LAoDAwKAwMCgODwsCgMDAoDAwKA+P/YWayMR9ZgO4AAAAASUVORK5CYII=" title="plot of chunk Plotting by group" alt="plot of chunk Plotting by group" style="display: block; margin: auto;" /></p>
<pre><code class="r"># Using the ToothGrowth dataset built into R, plot the tooth length (the len
# column) as a function of the vitamin C dosage (the dose column). Use a
# different color for each method of administering the vitamin C (the supp
# column).
head(ToothGrowth)
</code></pre>
<pre><code>## len supp dose
## 1 4.2 VC 0.5
## 2 11.5 VC 0.5
## 3 7.3 VC 0.5
## 4 5.8 VC 0.5
## 5 6.4 VC 0.5
## 6 10.0 VC 0.5
</code></pre>
<pre><code class="r"># We&#39;ll use a simple linear regression for this, but the general recipe is the
# same every time. The Recipe 1) Estimate the parameters of the best fit line 2)
# Make up your own x values that span the range of your data 3) Get your y values
# by applying your mathematical model (e.g. a straight line) with the best fit
# parameters to your fabricated x values 4) Plot these new y values against your
# fabricated x values.
# Save your model fit to an object. Here, we model Sepal.Length as a function of
# Petal.Length
model1 &lt;- lm(Sepal.Length ~ Petal.Length, data = iris)
# Now we have the parameter estimates for our y=ax+b line. The estimate for
# (Intercept) is b, and the estimate for Petal.Length is a.
summary(model1)
</code></pre>
<pre><code>##
## Call:
## lm(formula = Sepal.Length ~ Petal.Length, data = iris)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.24675 -0.29657 -0.01515 0.27676 1.00269
##
## Coefficients:
## Estimate Std. Error t value Pr(&gt;|t|)
## (Intercept) 4.30660 0.07839 54.94 &lt;2e-16 ***
## Petal.Length 0.40892 0.01889 21.65 &lt;2e-16 ***
## ---
## Signif. codes: 0 &#39;***&#39; 0.001 &#39;**&#39; 0.01 &#39;*&#39; 0.05 &#39;.&#39; 0.1 &#39; &#39; 1
##
## Residual standard error: 0.4071 on 148 degrees of freedom
## Multiple R-squared: 0.76, Adjusted R-squared: 0.7583
## F-statistic: 468.6 on 1 and 148 DF, p-value: &lt; 2.2e-16
</code></pre>
<pre><code class="r"># Make up our own x values; put them in a dataframe!
range(iris$Petal.Length)
</code></pre>
<pre><code>## [1] 1.0 6.9
</code></pre>
<pre><code class="r">xvals &lt;- seq(from = 1, to = 7, by = 0.1)
xvals
</code></pre>
<pre><code>## [1] 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6
## [18] 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3
## [35] 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0
## [52] 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0
</code></pre>
<pre><code class="r">df &lt;- data.frame(Petal.Length = xvals)
df
</code></pre>
<pre><code>## Petal.Length
## 1 1.0
## 2 1.1
## 3 1.2
## 4 1.3
## 5 1.4
## 6 1.5
## 7 1.6
## 8 1.7
## 9 1.8
## 10 1.9
## 11 2.0
## 12 2.1
## 13 2.2
## 14 2.3
## 15 2.4
## 16 2.5
## 17 2.6
## 18 2.7
## 19 2.8
## 20 2.9
## 21 3.0
## 22 3.1
## 23 3.2
## 24 3.3
## 25 3.4
## 26 3.5
## 27 3.6
## 28 3.7
## 29 3.8
## 30 3.9
## 31 4.0
## 32 4.1
## 33 4.2
## 34 4.3
## 35 4.4
## 36 4.5
## 37 4.6
## 38 4.7
## 39 4.8
## 40 4.9
## 41 5.0
## 42 5.1
## 43 5.2
## 44 5.3
## 45 5.4
## 46 5.5
## 47 5.6
## 48 5.7
## 49 5.8
## 50 5.9
## 51 6.0
## 52 6.1
## 53 6.2
## 54 6.3
## 55 6.4
## 56 6.5
## 57 6.6
## 58 6.7
## 59 6.8
## 60 6.9
## 61 7.0
</code></pre>
<pre><code class="r"># Take advantage of the predict() function, which returns a matrix with one row
# for each of your new x values, and 3 columns: &#39;fit&#39; is the expected y value,
# &#39;lwr&#39; is the lower 95% confidence interval, and &#39;upr&#39; is the upper 95%
# confidence interval. Note this only works this seamlessly using the predict()
# function on an lm() model
CI &lt;- predict(model1, newdata = df, interval = &quot;confidence&quot;)
CI &lt;- as.data.frame(CI) # Coerce the matrix to a dataframe, so we can access the column using the $ operator.
dim(df) # 61 x-values
</code></pre>
<pre><code>## [1] 61 1
</code></pre>
<pre><code class="r">head(df) # Here are the first 6 of them
</code></pre>
<pre><code>## Petal.Length
## 1 1.0
## 2 1.1
## 3 1.2
## 4 1.3
## 5 1.4
## 6 1.5
</code></pre>
<pre><code class="r">dim(CI) # 61 records, 3 columns
</code></pre>
<pre><code>## [1] 61 3
</code></pre>
<pre><code class="r">head(CI) # y-values, lower 95% CI bounds, and upper 95% CI bounds
</code></pre>
<pre><code>## fit lwr upr
## 1 4.715526 4.593399 4.837652
## 2 4.756418 4.637422 4.875414
## 3 4.797310 4.681409 4.913212
## 4 4.838202 4.725357 4.951048
## 5 4.879095 4.769263 4.988926
## 6 4.919987 4.813124 5.026850
</code></pre>
<pre><code class="r"># Plot the actual data (in the iris dataframe) This code copied from above
plot.colors &lt;- c(&quot;violet&quot;, &quot;purple&quot;, &quot;blue&quot;)
color.vector &lt;- plot.colors[iris$Species]
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;Iris sepal length vs. petal length&quot;,
xlab = &quot;Petal length&quot;, ylab = &quot;Sepal length&quot;, col = color.vector)
# Plot our best fit line. The x values are the Petal.Length column from the &#39;df&#39;
# dataframe, and the y values are the &#39;fit&#39; column from the CI dataframe. Note
# that I use the lines() function, which just adds features to an existing plot.
# The lwd= argument changes the line width
lines(x = df$Petal.Length, y = CI$fit, lwd = 2)
# Plot the confidence intervals The lty= argument changes the line type. There
# are 6 different line types, and you can just put a number 1 through 6 if you&#39;d
# like. Default is &#39;solid&#39; (aka 1)
lines(x = df$Petal.Length, y = CI$lwr, lwd = 2, lty = &quot;dashed&quot;, col = &quot;red&quot;)
lines(x = df$Petal.Length, y = CI$upr, lwd = 2, lty = &quot;dashed&quot;, col = &quot;red&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAllBMVEUAAAAAADoAAGYAAP8AOjoAOpAAZmYAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtmAABmADpmAGZmOgBmOpBmZgBmZjpmkJBmtttmtv+QOgCQOjqQOmaQkDqQkGaQ2/+gIPC2ZgC2tma2/7a2///bkDrbtmbb25Db/7bb/9vb///ugu7/AAD/tmb/25D/29v//7b//9v///9ARlHcAAAACXBIWXMAAAsSAAALEgHS3X78AAATHklEQVR4nO2dC3ujuBWGmcm6yW6nyWwvW2faZuiOO7uOnXX4/3+uIG4SSCAJ3Y743ueZDMHIEF4LHSFxXFTxuT19/Pb+XBTF4bd66fZUNIvn9pVuuWz+Lx4rtlmzpn+lKdu/x3Sr+3bhh4fD783/98PqhmvztrenDy/8/hqGXfRvx1bcb96hIwr7kiACW4RZl5zS1rAPL+0S+yi3n+KqX762R/vh5f25eeVUf6jZa83W4wee26p+s9vT4XxtPt3NQl0XjtWwmr138ybNWn5/DcMuhrdjm23foQt0hJ3Giwg77rGsK0Rh1dtDe5oauuW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dCCMGhBEDbRgxECUSA8KIAWHEgDBiQBgxIIwYEEYMCCMGhBEDwogBYcTYJAxEwFk9iVJToxSNvFMII7ZTCCO2UwgjtlPEesSAMGJAGDEgjBgQRgwIIwaEEQPCiAFhxHAkrEltZMP7czHk9DOlLIrj+lYK+DRnhjv9aPenNmnW7P5UIT+bG2G3J8u/4nRfO7M77dd764/JkGXVmGlaVpNdfjrb/ql8dlEnwt7/9av1qbP/sNvX6yHLqjHTtKwG2P+ZNeVgOvIlcVPRk/Ulsc+yagyfltWQ8hfrok3t7BejC7t9tr7I8B88I8Ysq8ZM0rIaUB7OtsdblePRxhb29uMGX7aXGaEVD7XTRpZlUf7sRha2oU1oMqTafmKtT900LathUfsrwrAcWVi54bNebqglW8J6252erIteubYPHWdiQBgxIIwYEEYMCCMGhBEDwogBYcSAMGJAGDEgjBjZCnt7KIoP3UjA7W/dzVN2F5W/ldpTbyFbnSD5CqvP//VwHpbHBZmZeh2ExaU5//W/a1Hcvz8XhzObAtMLu7Jf/vLUDAFfi4///me9xfc//9V6RDggWQu7Hr5/aoZ52/pz+/lbJ6xb+9O3etXt88vtiW3x48uGiQ7ByFcYa8OubLyN1baH+tdO2P/6te9f2Kpe6YY5UcHIVxhrktqhv+Yi+LGpS72wfi2EpUMrrL7OvT83Ompz16GGfe/X1obGSyKERaUL+lh4cXs6/PZU/Il54YKO1lAddPz9WG/xHcKoQMHTwO6F3Z62zOUJz+6FUQPCiAFhxIAwYkAYMSCMGBBGDAgjBoQRA8KIAWHEgDBiQBgxIIwYEEaM/wMGbKiWEtbYNQAAAABJRU5ErkJggg==" title="plot of chunk unnamed-chunk-2" alt="plot of chunk unnamed-chunk-2" style="display: block; margin: auto;" /></p>
<pre><code class="r">forecast &lt;- predict(model1, newdata = df, interval = &quot;prediction&quot;)
forecast &lt;- as.data.frame(forecast)
head(forecast)
</code></pre>
<pre><code>## fit lwr upr
## 1 4.715526 3.901879 5.529173
## 2 4.756418 3.943235 5.569601
## 3 4.797310 3.984574 5.610046
## 4 4.838202 4.025897 5.650508
## 5 4.879095 4.067202 5.690987
## 6 4.919987 4.108491 5.731483
</code></pre>
<pre><code class="r"># Plot the actual data (in the iris dataframe) This code copied from above
plot.colors &lt;- c(&quot;violet&quot;, &quot;purple&quot;, &quot;blue&quot;)
color.vector &lt;- plot.colors[iris$Species]
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;Iris sepal length vs. petal length&quot;,
xlab = &quot;Petal length&quot;, ylab = &quot;Sepal length&quot;, col = color.vector)
# New code using the forecast object
lines(x = df$Petal.Length, y = forecast$fit, lwd = 2)
lines(x = df$Petal.Length, y = forecast$lwr, lwd = 2, col = &quot;red&quot;, lty = &quot;dashed&quot;)
lines(x = df$Petal.Length, y = forecast$upr, lwd = 2, col = &quot;red&quot;, lty = &quot;dashed&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAllBMVEUAAAAAADoAAGYAAP8AOjoAOpAAZmYAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtmAABmADpmAGZmOgBmOpBmZgBmZjpmkJBmtttmtv+QOgCQOjqQOmaQkDqQkGaQ2/+gIPC2ZgC2tma2/7a2///bkDrbtmbb25Db/7bb/9vb///ugu7/AAD/tmb/25D/29v//7b//9v///9ARlHcAAAACXBIWXMAAAsSAAALEgHS3X78AAATg0lEQVR4nO2dC3vbthWGmTia3S6z011aO9scttHSypEr8///uREgCYF33M4BQH7v8zSlKUG0+BLAAQEeF1V8Lg/vv749FUVx+L3eujwUYvPUvNJul+L/xX0l3yb2dK+Ist1nDN9122x8uDv8If5/q3YLzuJjLw/vnvXjCdQhuo+TO269DxiIwr0kiICPMOeSQ5oa9u652ZKXcnMVV932uflt3z2/PYlXjvVFLV8T775e8Nq76g+7PBxOZ3F1i426LjxWarf8bPEhYq9+PIE6hPo4+Tb/A4bARNjx2ojI3/taNhR9YdXrXXOaBO32WJh8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B1xpJ9WGoXuukFCXClwFpCQv8gVskJWHAAAjLDAjLjMDCnG5soO+yIKwwp1lLxIY2RBeGWN6O2MLgy5LIfRh02RI5SoQvWxDWZwaEZQaEZQaEZUYcYQgOnYkiDIMvdyIIgy4f2IVhybwfMYQ5HxAgSswOL2EgAsHqSZSaGqVo5INCWGYHhbDMDgphmR0UsV5mQFhmQFhmQFhmQFhmQFhmQFhmQFhmQFhmBBImUhu58PZUqJx+tpRF8bj+rhn0NGeWB33v9lVFmjW3r9rLzxZG2OXB8Vscb2tnbqf9fOt8magsq9YM07LaHPLjyfWr6tlFgwh7+/dvzqfO/WJ3r9cqy6o1w7SsFrh/zZpSmY7cJHoVPTo3iV2WVWv0tKyWlD87FxW1s9uMLuzyybmR0S88K65ZVq0ZpGW1oDycXH/fqrz+trGFvf7g4cu1men14lwHFbIci+pnN7Iwjz5BZEh1vWKdT90wLatlUfcWQW1HFlZ6XOulRy3xCetdD3p0LnrW+j4MnDMDwjIDwjIDwjIDwjIDwjIDwjIDwjIDwjIDwjIDwjJjs8Je74riXTsTcPlHe/NU3kXVb6V21O+Y2p0g2xVWn//z4aS2rxtTZup9EBYXcf7r/85Fcfv2VBxOcglMJ+wsf/jbg5gCPhfv//NL/Y5vf/2784wwI5sWdj58+yimeZv6c/npayus3fvj13rX5dPz5UG+44dnj4UObGxXmOzDznK+Tda2u/rHVtj/ur1vn+WuTqnHmig2titMdknN1J9oBN+LutQJ6/ZCWDo0wup27u1J6KjNnVUN+9btrQ1dm0QIi0ob9Mnw4vJw+P2h+Iv0ogUdjaE66PjnY/2ObxCWCzl4Uuxe2OXBZy0PP7sXlhsQlhkQlhkQlhkQlhkQlhkQlhkQlhkQlhkQlhkQlhkQlhkQlhkQlhkQlhn/B0mBoS+ipfLjAAAAAElFTkSuQmCC" title="plot of chunk unnamed-chunk-3" alt="plot of chunk unnamed-chunk-3" style="display: block; margin: auto;" /></p>
<pre><code class="r"># This plot() call is copied from above
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;Iris sepal length vs. petal length&quot;,
xlab = &quot;Petal length&quot;, ylab = &quot;Sepal length&quot;, col = color.vector)
lines(x = df$Petal.Length, y = forecast$fit, lwd = 2)
# New code
polygon.x &lt;- c(df$Petal.Length, rev(df$Petal.Length))
polygon.y &lt;- c(forecast$lwr, rev(forecast$upr))
# By default, R won&#39;t fill in the polygon
polygon(x = polygon.x, y = polygon.y)
# But we also may not want an opaque polygon
polygon(x = polygon.x, y = polygon.y, col = &quot;darkgrey&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAk1BMVEUAAAAAADoAAGYAAP8AOjoAOpAAZmYAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtmAABmADpmAGZmOgBmOpBmZgBmZjpmkJBmtttmtv+QOgCQOjqQOmaQkDqQkGaQ2/+pqam2ZgC2tma2/7a2///bkDrbtmbb25Db/7bb/9vb///ugu7/tmb/25D/29v//7b//9v///82kr9XAAAACXBIWXMAAAsSAAALEgHS3X78AAAP8UlEQVR4nO3di3bbNhIGYCaOVm7XK6d7aeXsrsk22jQyHRnv/3RL8CZS5g0gQMxg/v+cNowskjY+DQhdPElU+FweP359e0qSZPdnsXV5TPTmufpKvZ3pP5ODKu+mb2m+ovdtjnF7r3218el+913/uW9v1sn1YS+PH56759NpT9Ecrrxhv/qEjpLY74kEyBow6z1vU1XYh+dqq3woV49i1Wzn1Xf74fntSX/lVDyoy6/pe18f8J17FQe7PO7OuX50642iFo6qvbk8tj6IvrV7Pp32FO3hyrutP6GLLAE7XSeR8vu+7usqfTD1el8Nk069/R6s/ML4+BU3Do1ffXN91nIGVr3zqVGw9Sd0kQVgrw/nt6fyAfb5+fXn6wPRH5hO1nlsFNuv9/UPXVwVDvqhftT18XrfH7/OveqB0vcoxn54/LIP/9WVenu+9hTt4cqvOjihgywE+/Lc3VD19cvZd9EHax7K5cmb7aw84+7crgiqB3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9nXddlk1zm1bVoPY/5hFslY68JS4ateT9ZTYdFk1Trctq2GyX6131dXZbAYHu3y2nmS6DzyjXLusGuemLatBst3Z9vtV2fW7DQ32+tMKL9tppncV3+qkGsty1+7oBgZbcU3QHVJtH7HWQ3fbltVwV/sZod0ODJateKxnK6pkzbLe9qQn613zzrUPT5yZBWDMAjBmARizAIxZAMYsAGMWgDELwJgFYMwCMGaJFuz1Pkk+1O8EXP5Rv3havorafSm1SXGPoZsJJl6wYvzz3bndvm4MyRS3ASxs9PgX/+VJsn97Snbn8iMwDVhe/uVvj/ot4Dz5+J/fint8++vfrd8R3jBRg+W7bw/6bd6qfi6/fK3B6lt//lrcdPn8fHks7/HT84oPOmyWeMHKa1hevt9WVtt98dca7H/NrW9fypsa0hWfidos8YKVl6TqrT89CX7UtdSANbcCjE4qsGKee3vSHIVc3lbYt+bWQug6JQIsaOpFX7m8uDzu/nxM/lK6dBYdlVCx6PjnsbjHN4BxCQenNuLBLo9rPsuzfcSDcQvAmAVgzAIwZgEYswCMWQDGLABjFoAxC8CYBWDMAjBmARizAIxZAMYs/wdRXPCTsizYbgAAAABJRU5ErkJggg==" title="plot of chunk Shaded region of forecast interval" alt="plot of chunk Shaded region of forecast interval" style="display: block; margin: auto;" /></p>
<pre><code class="r"># The adjustcolor() function is nice for &#39;turning down&#39; the opacity. It takes a
# color and the opacity level as arguments. I also use border=NA to suppress the
# border of the polygon
# First recreate the plot
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;Iris sepal length vs. petal length&quot;,
xlab = &quot;Petal length&quot;, ylab = &quot;Sepal length&quot;, col = color.vector)
lines(x = df$Petal.Length, y = forecast$fit, lwd = 2)
polygon(x = polygon.x, y = polygon.y, col = adjustcolor(&quot;black&quot;, alpha.f = 0.4),
border = NA)
# Add our legend back in
legend(&quot;topleft&quot;, pch = 19, col = plot.colors, legend = c(&quot;I. setosa&quot;, &quot;I. versicolor&quot;,
&quot;I. virginica&quot;), bty = &quot;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Zhf26mD9Mel3WTVmui2ryS0/Xm2LKu8uCiLs7R+/WYfO/sNuX6/7XVaNmW7LaoB9MRvK3nTgJtHp0ot1k9jtsmqMvC2rIeXfrC9ltbM7DC7s9tm6kZE/eEYMu6waM9mW1YDy/mr7futyeLehhb3+6ODLtpkZ9eJYN2WyLC+VoxtYmEOfwHZItf3EWoduui2r4aX2LUJ/HFhY6fBZLx1qiUtab3vTi/WlldT30YNzYpCwxCBhiUHCEoOEJQYJSwwSlhgkLDFIWGKQsMQgYYmxW2GvD0Xxrp0JuP3SDp7yUVR5KLWjecXS6QjZr7Am/tX9tT8eDpbMNOdIWFhY/Jv/V0VxeHsq7q98CUwnrOJ/+fmRTQFXxfv//nvzit//7d+tZ4QR2bWw6v73j2yaV9Sf25fvrbD27E/fm1O3z8+3R/6KH58dFjqgsV9hvA+r+Hwbr20PzV9bYf/szr595ac6pQ5rotDYrzDeJYmpP9YIvmd1qRPWnSVh8SCENe3c2xPT0Zir+hr2e3e2MTQ0iSQsKG3Sx9OL2+P9H4/Fv3AvUtIhDDVJx3+emlf8TsJSIQVPPdkLuz26rOXBJ3thqUHCEoOEJQYJSwwSlhgkLDFIWGKQsMQgYYlBwhKDhCUGCUsMEpYYJCwxSFhi/D83P+HjlWcyPQAAAABJRU5ErkJggg==" title="plot of chunk Shaded region of forecast interval" alt="plot of chunk Shaded region of forecast interval" style="display: block; margin: auto;" /></p>
<pre><code class="r"># as a shaded region on top of the iris data, the best fit line for a
# Sepal.Length~Petal.Length model, and the forecast interval.
</code></pre>
<pre><code class="r">model2 &lt;- lm(Sepal.Length ~ Species, data = iris)
bar.heights &lt;- predict(model2, newdata = data.frame(Species = c(&quot;setosa&quot;, &quot;versicolor&quot;,
&quot;virginica&quot;)))
# The basic barplot function
barplot(bar.heights)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAYFBMVEUAAAAAAGYAOjoAOpAAZrY6AAA6ADo6AG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UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UFg5UngG2G4Vqw7nIcbHd1tz1/9khSwWYOtr142N/e/X3q38+t/5C9em3LKsfBNqvDYX393/+ce9cJBlvuJdG1Lf+mw7Us/7betSz/jbNrmWCwCQabYLAJBptgsAkGm2CwCQabYLAJBptgsPWBvfwVqB+3/c0wrFrK64r/et4Gtvty1gM2rh7NOv63w2ZV8S9pF9j+67emr7DjxsueLhis7yWxMT2SXxIbwXZXbT/p8OM/FLNAsO3nvp9M+fHX4uWBtf1gSs2PnS0PbH386cyWNx3riq7fOMMmGGyCwSYYbILBJhhsgsEmGGyCwSYYbILBJhhsgsEmGGyCwSYYbILBJhhsgsEmGGyCwSYYbILBJhhsgsEmGGyCwSYYbILBJhhsgsEmGGyCwSYYbILBJhhsfwJRNuKwDVtpvQAAAABJRU5ErkJggg==" title="plot of chunk Barplots" alt="plot of chunk Barplots" style="display: block; margin: auto;" /></p>
<pre><code class="r"># Let&#39;s add some flair
barplot(bar.heights, names.arg = c(&quot;I. setosa&quot;, &quot;I. versicolor&quot;, &quot;I. virginica&quot;),
las = 1, col = adjustcolor(plot.colors, alpha.f = 0.5), main = &quot;Sepal length for 3 Irises&quot;,
ylab = &quot;Sepal length (cm)&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAwFBMVEUAAAAAADoAAGYAHJAAOjoAOpAAZmYAZrYcAAAzAAAzWv86AAA6ADo6AGY6OmY6OpA6ZmY6ZrY6kNtHbf9aMwBaf/9mAABmADpmAGZmOgBmOmZmOpBmZgBmZjpmZrZmkJBmtttmtv9tf/9/bZB/f7Z/f/+QOgCQOjqQOmaQkDqQ2/+2ZgC2Zjq2Zma2tma2/7a2/9u2///Pj/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5crvSmDDbjq154WrEz1h0Hrn/JMb/L7bf206ReOPyc6UJf2QHnb5btNvwmfnjZNkdotUFW0398FOqJ+2PmLWrFaf73KbFeDDbj2154WTP1RpWYHU3/Papk9TcQu1Pc9BDwDoR+Vvt9Uv3rtst0EVTdzf7sFjz+03wONZOPObWfdn+lLh2gfc+2vPfVzmNq+rEzbZd15PWbhTP+N36DLMlVd9F22mzAVmOn8EtjVv/a0YIWuy1KNPPv165BoF6rSlTfZw+pvv902fZfdJpgRqZy/jIfE4GC2c4PTD4ktmN2AH679tacC+2QH6jxRUw07A6hXZtKRtQvrVfKTVcBzRvoum1zvXXbSoetoehs+52ftpCMLN7kbd97uTWrS8YcBmN2Aq39tXjhPmBCnCQI2VdS+pF+9fGkAExbAhAUwYQFMWAATFsCEBTBhAUxYABMWwIQFMGEBTFgAExbAhAUwYQFMWAATFsCEBTBhAUxYABMWwIQFMGEBTFgAExbAhAUwYQFMWAATFsCEBTBhAUxYABMWwITl/xSYxqQVqFxcAAAAAElFTkSuQmCC" title="plot of chunk Barplots" alt="plot of chunk Barplots" style="display: block; margin: auto;" /></p>
<pre><code class="r"># These can be added to scatter plots in a similar way.
# We&#39;ll plot error bars representing 5 standard errors so you can see them more
# easily.
d &lt;- summary(model2)
CI &lt;- 5 * coef(d)[, &quot;Std. Error&quot;]
lwr &lt;- bar.heights - CI
upr &lt;- bar.heights + CI
# I used the ylim= argument to pass a 2-element numeric vector specifying the y
# extent of the barplot. I added some extra room on the top to account for error
# bars. Importantly, assign the barplot to an object. I called it &#39;b&#39; but you
# can call it whatever you like.
b &lt;- barplot(bar.heights, names.arg = c(&quot;I. setosa&quot;, &quot;I. versicolor&quot;, &quot;I. virginica&quot;),
las = 1, ylim = c(0, 7.5), col = adjustcolor(plot.colors, alpha.f = 0.5), main = &quot;Sepal length for 3 Irises&quot;,
ylab = &quot;Sepal length (cm)&quot;)
# The object that you called your barplot is interpretted by R as the x values in
# the middle of each bar
b
</code></pre>
<pre><code>## [,1]
## [1,] 0.7
## [2,] 1.9
## [3,] 3.1
</code></pre>
<pre><code class="r"># We&#39;ll use the arrows() function to add arrows to an existing plot. With some
# modifications, our arrows will have an arrowhead at each end (code=3), and the
# &#39;arrowhead&#39; will actually be perpendicular to the arrow shaft (angle=90)
# Specify where each arrow starts (x0= and y=) and ends (x1= and y1=)
arrows(x0 = b, x1 = b, y0 = lwr, y1 = upr, code = 3, angle = 90, length = 0.1)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAolBMVEUAAAAAADoAAGYAOjoAOpAAZmYAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6ZrY6kNtmAABmADpmAGZmOgBmOmZmOpBmZgBmZjpmZrZmkJBmtttmtv9/f/+QOgCQOjqQOmaQkDqQ2/+2ZgC2Zjq2Zma2tma2/7a2/9u2///Pj/fbkDrbtmbb25Db/7bb/9vb///2wPb/tmb/25D/29v//7b//9v////oermAAAAACXBIWXMAAAsSAAALEgHS3X78AAALfElEQVR4nO3dDXfiuBmGYYelMGlakunu9sPLtHjbaerNDLUL/v9/rZIsjM1XZEUIvcn9nDMnjEGS816xUMA4WZN66nmWmxtFprNotktzY7rePO6+Tp71A8zXg0fN2hs/zKff9ddZt1nF3J6ui/4Dp2s7bKX62HXa3vNN3doN2Q3TbYiVLNpIvjHVUhL1XJVluzTlM4UyjBtTxT3Y8FGVKmU9V/eWbZHzxmw2D9LRW+r53Uo1vVupu2bdqIX12oHNet03zX5nuq5iJX2w9tCaPFfmZzrThdU+pa6o/vkegvUeZRym66otdgdmN9ue88bcr7rLzV1d2lF2YPqeze4IU3d0w+w2RIsEsHZaPAZTW7MLYGrjKTC72fR7BsxsKvaH8B6sMWPerbphdhuilSJ9sNJWr5t8uimxNLPbiSmxfZSVOZwSD8F6U+Ku7m2n7f8OwGyr4UxobaMkfbDdcWSf56frbtHR/pgPwXqPsjK7RYdZKMyOwZr9oqM7UIr9SmIIdrQz3YZYSR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b5xTliQpwTA1isqGNJ//by1gAmLIAJC2DCApiwACYsgAkLYMICmLAAJiyACQtgwgKYsAAmLIAJC2DCApiwACYsgAkLYMICmLAAJiyACQtgwgKYsAAmLIAJC2DCApiwACYsgAkLYMICmLAAJiyACcv/AQY9hVzxImTdAAAAAElFTkSuQmCC" title="plot of chunk Error bars --------------- Adding error bars to our barplot." alt="plot of chunk Error bars --------------- Adding error bars to our barplot." style="display: block; margin: auto;" /></p>
<pre><code class="r"># of plant seedlings in 4 different treatments: ambient, watered, heated +
# watered, and heated. Make a bar plot with their 95% confidence intervals. Note
# these are asymmetric (more uncertainty above the mean than below) like what
# might come from a logistic regression model.
prop &lt;- c(0.18, 0.25, 0.13, 0.05)
asympLCL &lt;- c(0.14, 0.2, 0.11, 0.035)
asympUCL &lt;- c(0.24, 0.33, 0.18, 0.09)
</code></pre>
<pre><code class="r"># randomly generated data below are measurements of the number of the number of
# angels who get their wings as a function of the number of bells that have been
# rung. There is some uncertainty in measuring wing acquisition (represented as
# the offset from the sampled mean). How would you add error bars to a scatter
# plot?
set.seed(13)
n &lt;- 20 # Number of experimental trials
a &lt;- 12
b &lt;- 1.5
xvals &lt;- round(runif(n) * 50)
yvals &lt;- round(a + b * xvals + rnorm(n, sd = 5))
offset &lt;- rpois(n, lambda = 10)
lwr &lt;- yvals - offset
upr &lt;- yvals + offset
</code></pre>
<pre><code class="r"># 1) Use the pdf() graphics device (or png() or postscript()) to get a permanent
# record of your plot in the exact final format.
# First set your working directory. A working directory is where R assumes all
# input and output files that it interfaces with should be. When you send your
# code to a collaborator, they can just change the working directory once instead
# of changing the filepath for every input (e.g. reading data into R) or output
# (e.g. making a plot)
# This is how I set mine: 1) Make sure your script file is saved in a folder
# particular for the given project 2) Run the file.choose() function 3) Navigate
# to your script file and open it 4) Copy the file path in the console up until
# the actual file name (i.e. just the folder path) 5) Paste that folder into the
# setwd() function in quotes 6) Delete the file.choose() command
### file.choose()
###pdf(&quot;iris plot.pdf&quot;)
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, xlab = &quot;Petal length&quot;,
ylab = &quot;Sepal length&quot;, col = plot.colors[iris$Species])
lines(x = df$Petal.Length, y = forecast$fit, lwd = 2)
polygon.x &lt;- c(df$Petal.Length, rev(df$Petal.Length))
polygon.y &lt;- c(forecast$lwr, rev(forecast$upr))
polygon(x = polygon.x, y = polygon.y, col = adjustcolor(&quot;black&quot;, alpha.f = 0.4),
border = NA)
# Add our legend back in
legend(&quot;topleft&quot;, pch = 19, col = plot.colors, legend = c(&quot;I. setosa&quot;, &quot;I. versicolor&quot;,
&quot;I. virginica&quot;), bty = &quot;n&quot;, text.font = 3)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAolBMVEUAAAAAADoAAGYAAJkAAP8AOjoAOpAAZmYAZpAAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtgE5BmAABmADpmAGZmOgBmOjpmOpBmZgBmZjpmkJBmtttmtv+PTo+QOgCQOjqQOmaQkDqQ2/+ZmZmgIPC2ZgC2Zjq2/7a2///bkDrbtmbb25Db/7bb/9vb///ugu7/tmb/25D/29v//7b//9v///9wy4a1AAAACXBIWXMAAAsSAAALEgHS3X78AAAVsElEQVR4nO2dC3vbthVAGcf1JrdLFCdbttZxOitaraaV6cr8/39tBPgCHwDxuLgAiHu+1qVpsRbuCYCLh5CiIpKisH+SCICLMOsnCWt0hJ2KYscvyqK4Hz1LoKMh7OXd+fWBibp8fHz56Ul8lkBHU9jXR/Giavsvz++NWECnSXy5fcM1lXXDeBTaRBIWAA1h5U3bJJKwCNAQdto3rkZNYvMsgcWhu9CrYdWxlkZJRzAOBxNh1ZGl9ZdPT5TWB+JgKEwGCUPhcPAtrNwt3X399WnpNrHCwYew5+dn4T7LUuawrpBY5Pr6Wvajw8GHsOdn0diQSV7ueKfHp7Zebusv9VWtrb195N8QzJfM2AFDGEtPGurcsk4rT804rh7BnZp8s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7vNrSwlx8dfNk2M6NeHOuXMlmWj4rRDSzMoU9gJ6Ta/om1Dt30WFbDR+1bhP46sLCjw5/1o0MtcUnrbX/pyfrRUuj7aOCcGCQsMUhYYpCwxCBhiUHCEoOEJQYJSwwSlhgkLDFIWGJsVtjLbVG8aVcCLp/byVM+iypOpXbUr1i6HSHbFVbHv7w599fDxZKZ+h4JCwuLf/1vWRS714fi5sy3wHTCSv7N+zu2BFwWV//9pX7F93/803pFGJFNCytvvr9jy7xN/bl8emqFtXd/eqpvXT4+Xu74K358dNjogMZ2hfE+rOTrbby23dbftsJ+7+6+fuW3OqUOe6LQ2K4w3iU1S3+sEbxidakT1t0lYfHQCKvbudcHpqM2V/Y17Ht3tzY0NIkkLCht0sfTi8vdzR93xd+4FyHpaAzVSce/7+tXfCdhqZCCp57shV3uXPby4JO9sNQgYYlBwhKDhCUGCUsMEpYYJCwxSFhikLDEIGGJQcISg4QlBglLDBKWGCQsMf4PMrK4hQtgRe4AAAAASUVORK5CYII=" title="plot of chunk unnamed-chunk-4" alt="plot of chunk unnamed-chunk-4" style="display: block; margin: auto;" /></p>
<pre><code class="r"># Importantly, turn the device off at the end of your plotting block to complete
# the .pdf file.
###dev.off()
</code></pre>
<pre><code class="r"># that meets particular size and style guidelines, add some more arguments to the
# pdf() function call.
###pdf(&quot;iris plot for paper.pdf&quot;, width = 3.3, height = 3.3, pointsize = 9, family = &quot;Times&quot;)
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, xlab = &quot;Petal length&quot;,
ylab = &quot;Sepal length&quot;, col = plot.colors[iris$Species])
lines(x = df$Petal.Length, y = forecast$fit, lwd = 2)
polygon.x &lt;- c(df$Petal.Length, rev(df$Petal.Length))
polygon.y &lt;- c(forecast$lwr, rev(forecast$upr))
polygon(x = polygon.x, y = polygon.y, col = adjustcolor(&quot;black&quot;, alpha.f = 0.4),
border = NA)
# Add our legend back in
legend(&quot;topleft&quot;, pch = 19, col = plot.colors, legend = c(&quot;I. setosa&quot;, &quot;I. versicolor&quot;,
&quot;I. virginica&quot;), bty = &quot;n&quot;, text.font = 3)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAolBMVEUAAAAAADoAAGYAAJkAAP8AOjoAOpAAZmYAZpAAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtgE5BmAABmADpmAGZmOgBmOjpmOpBmZgBmZjpmkJBmtttmtv+PTo+QOgCQOjqQOmaQkDqQ2/+ZmZmgIPC2ZgC2Zjq2/7a2///bkDrbtmbb25Db/7bb/9vb///ugu7/tmb/25D/29v//7b//9v///9wy4a1AAAACXBIWXMAAAsSAAALEgHS3X78AAAVsElEQVR4nO2dC3vbthVAGcf1JrdLFCdbttZxOitaraaV6cr8/39tBPgCHwDxuLgAiHu+1qVpsRbuCYCLh5CiIpKisH+SCICLMOsnCWt0hJ2KYscvyqK4Hz1LoKMh7OXd+fWBibp8fHz56Ul8lkBHU9jXR/Giavsvz++NWECnSXy5fcM1lXXDeBTaRBIWAA1h5U3bJJKwCNAQdto3rkZNYvMsgcWhu9CrYdWxlkZJRzAOBxNh1ZGl9ZdPT5TWB+JgKEwGCUPhcPAtrNwt3X399WnpNrHCwYew5+dn4T7LUuawrpBY5Pr6Wvajw8GHsOdn0diQSV7ueKfHp7Zebusv9VWtrb195N8QzJfM2AFDGEtPGurcsk4rT804rh7BnZp8s729q5rkM3ukwg4HFGH1cK29Kos9Hwywbq2ud83VzZnf5pAwhkzYwZuwcR8m5hzHN48ln3bc1fWO92L8S32btYjjUUK+aPjymSWeOgus0Tvt22SjrneNq/1wm1c5YpkDlrAh5yivnmo/zEpZV7Q67/jxkd1rbvP5kyvK9CUcpnQ/gBfGp0SaVpFPkbD5kSs2S7Jrr9rb9df3P5GwRWa6aKYjZhZ0kbB4WdRFwqJF4ouExYlMFwmLE7kvEhYhCl0hllcGRvsMFr7PFKUvYGHfvn0T7i8vr8gZJh8zRq0LWNi3b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+rOTrbby23dbftsJ+7+6+fuW3OqUOe6LQ2K4w3iU1S3+sEbxidakT1t0lYfHQCKvbudcHpqM2V/Y17Ht3tzY0NIkkLCht0sfTi8vdzR93xd+4FyHpaAzVSce/7+tXfCdhqZCCp57shV3uXPby4JO9sNQgYYlBwhKDhCUGCUsMEpYYJCwxSFhikLDEIGGJQcISg4QlBglLDBKWGCQsMf4PMrK4hQtgRe4AAAAASUVORK5CYII=" title="plot of chunk Figure for a paper -------------- To make a figure for a paper" alt="plot of chunk Figure for a paper -------------- To make a figure for a paper" style="display: block; margin: auto;" /></p>
<pre><code class="r"># Importantly, turn the device off at the end of your plotting block to complete
# the .pdf file.
###dev.off()
</code></pre>
<pre><code class="r"># 2) You can change some fundamental plotting parameters by using par() before a
# plot.
# This is how you can: Make multipanel plots Give your plots more room in the
# inner margins Give your plots some room in the outer margins
</code></pre>
<pre><code class="r">setosa &lt;- subset(iris, subset = Species == &quot;setosa&quot;)
versicolor &lt;- subset(iris, subset = Species == &quot;versicolor&quot;)
virginica &lt;- subset(iris, subset = Species == &quot;virginica&quot;)
# Using par(mfrow=c(number of rows, number of columns))
par(mfrow = c(2, 2))
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
plot(x = setosa$Petal.Length, y = setosa$Sepal.Length, pch = 19, las = 1, col = plot.colors[1],
main = &quot;I. setosa&quot;, ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
plot(x = versicolor$Petal.Length, y = versicolor$Sepal.Length, pch = 19, las = 1,
col = plot.colors[2], main = &quot;I. versicolor&quot;, ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
plot(x = virginica$Petal.Length, y = virginica$Sepal.Length, pch = 19, las = 1, col = plot.colors[3],
main = &quot;I. virginica&quot;, ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
</code></pre>
<p><img src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YSkk52idc/nh1bWlUSHzlrSZvME4duTaiXZeWnX9vc3d0XrbbxYs2PnQpfNNMo5MhZQ5WjWHyI/QuiVRyLolbSZvKK4duXainZd2RHPs/jXbi/X236yNCIn96+GVnD5TITlHq47m549q/q2lkHVL80zeCFw7cu1kPi+typdPdnux3v6bteGCXR/5Ff3Z+uMMhZQ5Wqdcfvib/0TWLYlC1i1pM3kDce7ItRPtvLQj2GXF7Uz2Yr3V047wSsc8a9ZUqG0thZrdbufckihk3ZLvMdnw2ZFrJ1afv7zY7cV62wFwAgVr5Ilgvl+IQsocrXOuH933sKGQdUvaTN5gHDty7UQ7Ly2g/Y3wWuL96zRrNqoQ/4lACmkzeYNx7Mi1E4/11t/E8zej5zB0kGDIIMGQQYIhgwRDBgmGDBIMGSQYMvIJdt7tdncv/ed/+vZN0Wgy55/X+HbczGT2K6Ngh5sTfTOQxTFWAI9gef3KLdj1cXf/2uz2l4fdu2fpGF987k7V6+O7X46swPnHB3He1k1mv3KHRN4wzE40Fjyao3SMLz7v2d/m+PZ07M5E5n98U25GMvuV9wpr2xNzb983cu5GjvHF7FNz/PzM/teHDiSC5fUrt2B9P/jHV3b8J/VM5J+6M5GtwCdYNr9yC8aC+u7w9rRngeTXQ+8YPze7xdwX9un7Y1cAl2DZ/KruOYyfiaUPIgFQflUnGK9XlT6IBED5VZ1ghB0SDBkkGDJIMGSQYMggwZBBgiGDBEMGCYYMEgwZJBgySDBk/B9nJ4o5PkngjAAAAABJRU5ErkJggg==" title="plot of chunk Multi-panel plots" alt="plot of chunk Multi-panel plots" style="display: block; margin: auto;" /></p>
<pre><code class="r">###dev.off()
# Using layout(matrix())
plot.matrix &lt;- matrix(c(1, 1, 2, 3), nrow = 2, ncol = 2)
plot.matrix
</code></pre>
<pre><code>## [,1] [,2]
## [1,] 1 2
## [2,] 1 3
</code></pre>
<pre><code class="r">layout(mat = plot.matrix)
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
plot(x = versicolor$Petal.Length, y = versicolor$Sepal.Length, pch = 19, las = 1,
col = plot.colors[2], main = &quot;I. versicolor&quot;, ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
plot(x = virginica$Petal.Length, y = virginica$Sepal.Length, pch = 19, las = 1, col = plot.colors[3],
main = &quot;I. virginica&quot;, ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
# Or we can adjust the widths of the plots (the heights, too). The widths=
# argument should be the same length as the number of columns while the heights=
# argument should be the same length as the number of rows. The values represent
# multipliers.
layout(mat = plot.matrix, widths = c(2, 1))
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
plot(x = versicolor$Petal.Length, y = versicolor$Sepal.Length, pch = 19, las = 1,
col = plot.colors[2], main = &quot;I. versicolor&quot;, ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
plot(x = virginica$Petal.Length, y = virginica$Sepal.Length, pch = 19, las = 1, col = plot.colors[3],
main = &quot;I. virginica&quot;, ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAkFBMVEUAAAAAADoAAGYAAP8AOjoAOpAAZrY6AAA6ADo6AGY6OgA6Ojo6OpA6ZmY6ZrY6kJA6kNtaG/BmAABmAGZmOpBmZgBmZjpmZmZmZrZmkNtmtv+QOgCQOmaQ2/+gIPC2ZgC2Zjq2Zma2tv+2/9u2///bkDrbkGbb/7bb/9vb////tmb/25D/29v//7b//9v///9NponiAAAACXBIWXMAAAsSAAALEgHS3X78AAAV0ElEQVR4nO2dDWPaOBKGSfYC99Hd5ZJ0t0ea0t7G1wIl/P9/d7JkgbGlkWRLssa8z94VYixZ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PRCMxCeRFFPIFoRPIimuYQUxJJE07jOX3fZAMJIB/bDITzV3q4dgJBCMGUNGOuASJ2RWQ1O3AARjBgRjxgwEuzGCv9HU7Rn8i/Ar6LUX56r8Svps8dsJgo2syq8kBCumKr+SJQgGpgGCMQOCMQOCMQOCMQOCMQOCMQOCMWOoYNXGvc/xcXH/5trpKiOCQM3d6KrqMrEjtdeDs6rWPFtBGGaY7B++P/GsrY2GnQYKtl14CCZErZxW79d1Yp+TZu5GkquJHclWeTS+Xgg9GNMMkx2ME8920W007DRMsON/vWw+tWYVs6MWinfQzN1IcpnYkeLbR5+9WqmGAfRmmOzTn3iWaKNhp5QuUU8H59jn0cMl6rkbSa4mdrSy3XiJMeQEM84w2cE48aytjYadkgp2fPKy2uP7872meFQllPDY6/Cbx9G6GGeY7NOfeLZLq43dnVIKdviHj6/z+8H7nKxXEzuO3GuQRzTOMGk5PNkMYqeUgm19TguvoO3kJZhfwOl3QM9rdBfDDJP9w/fzhY1tNO+EfhgzIBgzIBgzIBgzIBgzIBgzIBgzIBgzyhJsL7ra+o7MT9W71WNqfX7uBg5H5CeiXYUJtj4boUc2rIaJHfgIFs+uEgU7Pi4edtVieVgt7l4vhsnN+/qneny8+2Mjdtj/unLfIS2BiHYVJph0HXI8WPzQhPOoNhfD5Ob9UrxWm/eXTf1LFPYPG/PLTES7ChNM+oJ60Hiphj4XLcPkZvGu2nx9Ff8o18FEsHh2lSiYujv+vBPt317/EuW7+pcoPuAnWBS7ShRMOPXF+v1lKRzJn2tlmPxt1pulLeLdvzb1DrwEi2JXWYJ5In+JUzciAT52sRRMxlVTNyIBPnaxFOyWgWDMgGDMgGDMgGDMgGDMgGDMgGDMgGDMgGDMgGDMgGDM+D9oCVPC0KDmtAAAAABJRU5ErkJggg==" title="plot of chunk Multi-panel plots" alt="plot of chunk Multi-panel plots" style="display: block; margin: auto;" /></p>
<pre><code class="r">###dev.off()
</code></pre>
<pre><code class="r"># to waste white space, so we can specify the plotting margins using
# par(mar=c(bottom, left, top, right)). This can be important if your labels
# aren&#39;t fitting on the plot. The default is par(mar=c(5.1, 4.1, 4.1, 2.1)).
# Let&#39;s say I want to make the text bigger because the plot is for a
# presentation. We can use the cex (character expander) family of arguments in
# the plot() call. cex= makes the plotted points larger or smaller cex.main=
# makes the title larger cex.lab= makes the axis labels larger cex.axis= makes
# the numbers of the axis larger
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAhFBMVEUAAAAAADoAAGYAOjoAOpAAZmYAZrY6AAA6ADo6AGY6OmY6OpA6ZmY6kNtmAABmADpmAGZmOgBmOpBmZgBmZjpmkJBmtttmtv+QOgCQOjqQOmaQkDqQ2/+2ZgC225C2/7a2///bkDrb25Db/7bb/9vb////tmb/25D/29v//7b//9v///9jDH5LAAAACXBIWXMAAAsSAAALEgHS3X78AAAMx0lEQVR4nO2dDXujuBVGmYzrzDZ1Mtt21542dMezazw2////lQ9DRGKwxIfQi895nmQYjAzmGOkKiZsoXSbn3cP/Htdpenp++J7/5Ovyf8+7KIpWfxZro3zxkMb5v9EmrVcETdS/JMzAEGG9S/pgH22Ln49X2KfX6rrLPn/2QlKeiU+v1YqQsRG2j6J1sZB9sm2jbMAUNV9+4O3C0uNj4akWVq2Y+9i7sBB2fDqcd7mo08vr8Rfj+xe0sOLc59dLh7CcONoeH81mK258KYPDUti3V3MhvbRfEx/bIPZZEFGc/XZhpdPslTLoWB3qFQFjUyUeH8taIskqxtj4+oUsLKsR8yPdR+sbVWLx0eKoDA7rFeFiISxZXapEJWGLxULYflO6alSJZVnwjt0VlsZ5gyAVdCwVmzYsLqLjr9+lwvqlstyO80JBmBgICwCXLi3C5sfpJgTC5gdhYiBMDdqwBYMwMRAmBsLEQJgYCBMDYWIgTAyEiYEwMR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UWVadeZ+W1WWXT4e+H9XMLjqKsPN//uh96vp/2ftf13WWVWfep2V1oP/HzIhr0zNXiYOK7ntXiVWWVWfMtKyOxL/1LppfndXi7MJOL70rGfOL58RbllVn3qVldSBeHfoebxq/He3cwo5fBvjqW800WnFfO81l9Sxqnt2ZhQ1oE/IMqX2/sb1P3fu0rI5F+9cI9fLMwuIB3/V4wFUyJKzvu9N976KJ0fbRcRYDYWIgTAyEiYEwMRAmBsLEQJgYCBMDYWIgTIyFCjs+RtGnyzjA6Z+XW6fFPVTzRqpJtlXbS0GxVGHZuU9Wh3r5baHNSrYeYfORn/vsJ4mi9XkXrQ7FBBhTWFKs+MdzPgicRA///T3b6sfff+09JuyNBQtLVj+e8kHe8to5ff1uCDuWr/zyPVt9enk9PRdbfXkdMNXBE0sVVrRhSTHaVlxtj9l/DWH1K+dvr0dD64BZUZ5YqrBSy/qynDzk15EprHoFYWFwqfi+vJ53uYrMT9K4wupXMkNvVSLCZsMMLU7Pqz+fo78VTsrKMluZXKKQ3FAWdPxrm231A2EqhO+pBmHZFThkNo9vECYGwsRAmBgIEwNhYiBMDISJgTAxECYGwsRAmBgIEwNhYiBMDISJ8X+FuDQl6aAQjwAAAABJRU5ErkJggg==" title="plot of chunk Specifying margins ---------------- We want to make sure not" alt="plot of chunk Specifying margins ---------------- We want to make sure not" style="display: block; margin: auto;" /></p>
<pre><code class="r">plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;, cex = 2, cex.main = 4, cex.lab = 3,
cex.axis = 1.5)
# A solution
par(mar = c(5, 6, 5, 2))
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;, cex = 2, cex.main = 4, cex.lab = 3,
cex.axis = 1.5)
# Note that the par(mgp=c(labels, tick marks, axis line)) method will adjust the
# location of those components away from the edge of the plot. Default is
# par(mgp=c(3,1,0))
par(mar = c(6, 7, 5, 2), mgp = c(4, 1.5, 0))
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = &quot;Sepal Length&quot;, xlab = &quot;Petal Length&quot;, cex = 2, cex.main = 4, cex.lab = 3,
cex.axis = 1.5)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAaVBMVEUAAAAAADoAAGYAOmYAOpAAZrY6AAA6ADo6AGY6OgA6Ojo6kJA6kNtmAABmOgBmZjpmZrZmtrZmtv+QOgCQ27aQ2/+2ZgC2tma2///bkDrbtmbb25Db/9vb////tmb/25D//7b//9v///9VO8oJAAAACXBIWXMAAAsSAAALEgHS3X78AAAYJElEQVR4nO2d7YLkKm6G6+xOz2aTniTbs+ukkmz1TN//RaZsAwYhMBJgI5feH+d0FQZr9BQfxoBuXypRup1tgIomBSZMCkyYFJgwKTBhUmDCpMCESYEJkwITJgUmTApMmBSYMCkwYVJgwqTAhEmBCZMCEyYFJkwKTJgkAPv8flv1p/8OEyb/2wm95KnfP1MpWDGjSwKw+83qI0xQYEPKOHzWW5iiwIaUaxEjpyqwIbW1iLfbe5CiwEaU1yLebt/+6ScpsBG1toh//Mfi1T/+4Sc1AiZK4wNbW8Rv//s9bhMV2IAy7n43/w/axCpgv35ETSzIcYueI2Y9sMZ5N1czDQ/MjBE/TE0L2kQGsPXDsxTj9/lJAeT0RqUxmGlLCZvnbK6GGh7Y3XrzM24TK4BZXnNtCHP6g1LIZamVm7zHwlyuphodmPH2m3OW/9vlA/u79fz8bZATet73PeDlEcvlaqvRgT1cPTB+9R3BBrbpHeQMW7Zb8BuBeW+uvudyNdbowDxnPgIfgUQmsAW/n/O+/UC2emMGEXcvj/93PldjDQ7MNEJv3t/eL7ce2FKYl9MkW1+bmvPm22Lu7/98crlaa3BgXouItIlVwD6wYlYo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i0aSNpcCESYEJkwITJgUmTApMmBSYMCkwYVJgwqTAhEmBCdP/Ax4vlaMHk+H0AAAAAElFTkSuQmCC" title="plot of chunk Specifying margins ---------------- We want to make sure not" alt="plot of chunk Specifying margins ---------------- We want to make sure not" style="display: block; margin: auto;" /></p>
<pre><code class="r"># especially great for multi-panel plots. Let&#39;s recreate the one that we had
# earlier and add some outer margins with par(oma=c(bottom, left, top, right))
# The default is par(oma=c(0,0,0,0))
###dev.off()
par(mfrow = c(2, 2), oma = c(5, 5, 5, 0), mar = c(2, 2, 4, 2))
# Note here that I use the font.main= argument in each of these plot calls to
# make the title in normal font for the first panel and then italicized for the
# other panels (it is bold by default; equivalent to a font.main=2)
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = NA, xlab = NA, cex.main = 2, font.main = 1)
plot(x = setosa$Petal.Length, y = setosa$Sepal.Length, pch = 19, las = 1, col = plot.colors[1],
main = &quot;I. setosa&quot;, ylab = NA, xlab = NA, cex.main = 2, font.main = 3)
plot(x = versicolor$Petal.Length, y = versicolor$Sepal.Length, pch = 19, las = 1,
col = plot.colors[2], main = &quot;I. versicolor&quot;, ylab = NA, xlab = NA, cex.main = 2,
font.main = 3)
plot(x = virginica$Petal.Length, y = virginica$Sepal.Length, pch = 19, las = 1, col = plot.colors[3],
main = &quot;I. virginica&quot;, ylab = NA, xlab = NA, cex.main = 2, font.main = 3)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAh1BMVEUAAAAAADoAAGYAAP8AOpAAZpAAZrY6AAA6AGY6OgA6OpA6ZrY6kJA6kNtmAABmAGZmOpBmZgBmZrZmkJBmkNtmtttmtv+QOgCQOmaQ2/+gIPC2ZgC2Zjq2Zma2tv+2/7a2///bkDrbkGbbtmbb/7bb/9vb///ugu7/tmb/25D//7b//9v///9rd14NAAAACXBIWXMAAAsSAAALEgHS3X78AAAVn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1kyXxdVpLjk73sK61UmLuKh9I0BS7jUVlHjJQIxD6VvyyUmXGqrqPESgZjlmCvEIRHJX+tS637ny63GSwQSx7Beikj+mpda/3vLbq2/RGBjwHyX2p0DS2lzWy7Re6ltg9cWgK0gzMPijrUd0bW8J7CYhsPFLXdeVGD/rKK89iruUqVhAFsoqrhLlYYBbKGo4i7QmgIwYgIwYgIwYgIwYgIwYgIwYgIwYqoPTKW/Z2lwZ/H0IJ2m8yfrHWvOYsfOzmUaSfK2Hmja+WSgKrFfGGcVOX8Fv+oDO+3YXVzjRpNdPHuQbtLbCz8Rz86q2L2zc5lGivytB5p2PhnI5Xxh3LzI8ysE1MIlvv3yejVu5drF04N0Mx1//jxfaeEsdu9sL9NIlL/1QNP2k4FK9gvjrCLPrxBQA2CXZ+4AfvP8bLJ49iDdqPOnP/hv5tlZFbt3di7TSFCg9UDTzicDuZwvjJsXuU8kpCZBh71Ywi6+Xl3Fx2EYAjurYvfOy0cOK9x6oGnPCTlfGDcvch8qpPrAjtPF4xpJVPHsQTpNl8+hMUwWu3d2LtNIkrf1QNPOJwPzd1pSkyjRfk1adDH7zQKlwWLnMo0keVsPNO0vCpzq0q/gF+ZhxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxARgxPR/OGAOEH1F5U4AAAAASUVORK5CYII=" title="plot of chunk Specifying outer margins -------------- Outer margins are" alt="plot of chunk Specifying outer margins -------------- Outer margins are" style="display: block; margin: auto;" /></p>
<pre><code class="r"># are mtext(), which adds text to a margin, and axis(), which draws in a
# user-specified axis.
# mtext() lets me: 1) Make axis labels that are shared between more than one
# panel 2) rotate the y-axis label so it is easier to read for presentations
# axis() lets me: 1) Specify exactly how many tick marks and where they&#39;ll be 2)
# Specify exactly how those tick marks will be labelled
# We actually set up the previous 4-panel plot nicely to see the functionality of
# mtext() and axis(). Let&#39;s recreate that plot.
par(mfrow = c(2, 2), oma = c(5, 6, 5, 0), mar = c(2, 2, 3, 2))
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = NA, xlab = NA, cex.main = 2, font.main = 1)
plot(x = setosa$Petal.Length, y = setosa$Sepal.Length, pch = 19, las = 1, col = plot.colors[1],
main = &quot;I. setosa&quot;, ylab = NA, xlab = NA, cex.main = 2, font.main = 3)
plot(x = versicolor$Petal.Length, y = versicolor$Sepal.Length, pch = 19, las = 1,
col = plot.colors[2], main = &quot;I. versicolor&quot;, ylab = NA, xlab = NA, cex.main = 2,
font.main = 3)
plot(x = virginica$Petal.Length, y = virginica$Sepal.Length, pch = 19, las = 1, col = plot.colors[3],
main = &quot;I. virginica&quot;, ylab = NA, xlab = NA, cex.main = 2, font.main = 3)
# By default, an mtext() call will put an axis label on the specified side
# (1=bottom, 2=left, 3=top, 4=right) of the most recently created panel. It also
# puts it right at the margin. Use the line= argument to move it further from the
# margin however far you choose. These line units are the same units as those
# used by par(mar=c()).
mtext(side = 1, text = &quot;Petal Length&quot;, line = 3)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAolBMVEUAAAAAADoAAGYAAP8AOmYAOpAAZpAAZrY6AAA6ADo6AGY6OgA6OpA6ZrY6kJA6kNtmAABmADpmAGZmOgBmOjpmOpBmZgBmZrZmkJBmkNtmtttmtv+QOgCQOjqQOmaQZgCQ27aQ2/+gIPC2ZgC2Zjq2Zma2tv+225C2/7a2///bkDrbkGbbtmbb/7bb/9vb///ugu7/tmb/25D//7b//9v///8IOGl2AAAACXBIWXMAAAsSAAALEgHS3X78AAAWoElEQVR4nO2di5rbthGF6XVcbVwnUt3GvWiTdq246SpNHUnL93+1CjcS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E4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4ARE4AR0/8BacenUffF3pQAAAAASUVORK5CYII=" title="plot of chunk The two add on functions that I find myself using most often" alt="plot of chunk The two add on functions that I find myself using most often" style="display: block; margin: auto;" /></p>
<pre><code class="r"># We can specify outer=TRUE to put this text on the outer margins. This works
# only because we used par(oma=c()) to make the outer margins greater than 0 on
# some sides.
# Recreate the plot
par(mfrow = c(2, 2), oma = c(5, 6, 5, 0), mar = c(2, 2, 3, 2))
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = NA, xlab = NA, cex.main = 2, font.main = 1)
plot(x = setosa$Petal.Length, y = setosa$Sepal.Length, pch = 19, las = 1, col = plot.colors[1],
main = &quot;I. setosa&quot;, ylab = NA, xlab = NA, cex.main = 2, font.main = 3)
plot(x = versicolor$Petal.Length, y = versicolor$Sepal.Length, pch = 19, las = 1,
col = plot.colors[2], main = &quot;I. versicolor&quot;, ylab = NA, xlab = NA, cex.main = 2,
font.main = 3)
plot(x = virginica$Petal.Length, y = virginica$Sepal.Length, pch = 19, las = 1, col = plot.colors[3],
main = &quot;I. virginica&quot;, ylab = NA, xlab = NA, cex.main = 2, font.main = 3)
# We can just use cex= to make the text bigger here (rather than cex.lab=)
# because we&#39;re already in the mtext() function
mtext(side = 1, text = &quot;Petal Length&quot;, outer = TRUE, line = 3, cex = 2)
# Do the same for the y axis
mtext(side = 2, text = &quot;Sepal Length&quot;, outer = TRUE, line = 3, cex = 2)
# And the same for an overall title
mtext(side = 3, text = &quot;Sepal length vs. petal length for Irises&quot;, outer = TRUE,
line = 2, cex = 2.1)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAn1BMVEUAAAAAADoAAGYAAP8AOmYAOpAAZpAAZrY6AAA6AGY6OgA6OpA6ZmY6ZrY6kJA6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GYQinFHu9SbdOuqFo3sGMAyXxrniq7wiVIKi2wCZ1H7nNidhpvF+s9PZDpA3je71JvRNrchTKO5ix903p0iQbah4lugt+Ju2kly28M7bXO7EmR6G8gxmHzxgs40bhw8J+GDAhMGBCYMCEwIAJgQETAgMmBAZMCAyYEBgwITBgQmDAhMCACYEBEwIDJgQGTAgMmBAYMCEwYEJgwITAgAmBARMCAyYEBkwIDJgQGDAhMGBCYMCEwIAJgQETAgMmBAZMCAyYEBgwITBgggrs7VUsZuxdlOXFeW/47VU78P7y4UvBSVm2hYkrCT6wwX1J+P3z0AIYzxaBlejtVVy1Wa7SIIXAzicFbJmctWQQ2PmkAeMXcL2cw0D/mqijZNd2EMukxICppOuej18nvWUcqc8d1+xEtiTxHGg82+thgM28QbtpwEa+jdTACDAt6brnd39mv67sQPr3h08msE8qQW89ADDqEtcg5EL/Jli475rZJZ3oP2FgRlJC6EpzIEfwfyYGR7pEcUjesl51BB/YxGvVhf+6yCs7slqy/rrGgBlJVxq8apHDZ+4oZwuYdkhvwQWmwnp6u/OLR9ogK+jYAGYmFRTY4Rw5OZsOTD+kt+ADo5de47f+1oHRgCIGzEwq9tDDVT6jAUw7pLvgAjPiPD8wEU2UAxNpENheOcD0i6eCDgJhwyWaSbGGNZIFzGm11PXdbsP0pCYN0YYZGSKwElnA1kvLYux5kEGHOIRFdeEo0Uhq0ghEiQgsXzYwvtjxLLpIN61/FW/DzKQmDd4PmwcEtlc2MBlg0D7VSCFNfJzjv8lGC5gMNG5mUosGP/Djj7xjR7JFYCVygLH4nTdH5O8LJ3Fjvi4CTE/q0FBjiSJbBHZ++Yb/DxICi0mMWh37RMUQAouJPxxdPWjZ+twNhMBiYo0bf0BzDiGwuObDHnwFhMCACYEBEwIDJgQGTAgMmBAYMCEwYEJgwITAgOn/AekAt1ME1wPSAAAAAElFTkSuQmCC" title="plot of chunk The two add on functions that I find myself using most often" alt="plot of chunk The two add on functions that I find myself using most often" style="display: block; margin: auto;" /></p>
<pre><code class="r"># We can also use the las= argument to rotate axis text using mtext(). We can
# make the y-axis label in the reading direction this way.
# Recreate the plot. Add some extra outer margin space to the left.
par(mfrow = c(2, 2), oma = c(5, 9, 5, 0), mar = c(2, 2, 3, 2))
plot(x = iris$Petal.Length, y = iris$Sepal.Length, pch = 19, las = 1, main = &quot;All Irises&quot;,
ylab = NA, xlab = NA, cex.main = 2, font.main = 1)
plot(x = setosa$Petal.Length, y = setosa$Sepal.Length, pch = 19, las = 1, col = plot.colors[1],
main = &quot;I. setosa&quot;, ylab = NA, xlab = NA, cex.main = 2, font.main = 3)
plot(x = versicolor$Petal.Length, y = versicolor$Sepal.Length, pch = 19, las = 1,
col = plot.colors[2], main = &quot;I. versicolor&quot;, ylab = NA, xlab = NA, cex.main = 2,
font.main = 3)
plot(x = virginica$Petal.Length, y = virginica$Sepal.Length, pch = 19, las = 1, col = plot.colors[3],
main = &quot;I. virginica&quot;, ylab = NA, xlab = NA, cex.main = 2, font.main = 3)
mtext(side = 1, text = &quot;Petal Length&quot;, outer = TRUE, line = 3, cex = 2)
# Use las=1 here to rotate the text. Use \n to insert a carriage return.
mtext(side = 2, text = &quot;Sepal\nLength&quot;, outer = TRUE, line = 1.5, cex = 2, las = 1)
# I added an \n in the middle of the character string to insert a carriage
# return. I also changed the line= argument from 2 to 0.
mtext(side = 3, text = &quot;Sepal length vs. petal length\nfor Irises&quot;, outer = TRUE,
line = 0, cex = 2.1)
</code></pre>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbAAAAGwCAMAAAD/kMAYAAAAolBMVEUAAAAAADoAAGYAAP8AOjoAOmYAOpAAZpAAZrY6AAA6AGY6OgA6OpA6ZmY6ZrY6kJA6kLY6kNtmAABmAGZmOgBmOpBmZgBmZrZmkJBmkNtmtttmtv+QOgCQOmaQZgCQtpCQ2/+gIPC2ZgC2Zjq2Zma2kDq2tv+2/7a2/9u2///bkDrbkGbbtmbb/7bb/9vb///ugu7/tmb/25D//7b//9v///9aQbDkAAAACXBIWXMAAAsSAAALEgHS3X78AAAdk0lEQVR4nO2dDZ/kJnKHdet4ryfnnNMTey/J7PlseS/JyrmsNbP9/b9axEvxDgIENKjr/7N3uiUkqvUIKKCQphtqKE33NgCVJgQ2mBDYYEJggwmBDSYENpgQ2GBCYIMJgQ2mOwD7+nEiuqYe9/b8h5/dX+L1+vTuc8ZhWapjb3tg8wR6STvw2AV