6.1 Defining Colors

par(mfrow=c(1,1),mar=c(3,0,2,0))
x <- rep(1:8)
y <- rep(1, times = 8)
plot(x,y, col= 1:8, pch= 15, cex= 3, ylim= c(0,2), yaxt= "n",
     main= "Colour Numbers in R: 'col = 1 to 8'")

png("Figure1.png", width = 100, height = 100, units = 'mm', res = 300)

6.2 Defining Symbols (Points)

x <- c(1, 2, 3, 4, 5)
y <- c(2, 4, 5, 6, 7)
plot(x, y, main = "Some Linear Scatterplot", col = 1,bg = 8, pch = 17, cex = 2)

6.2 Defining Line Types

x <- c(1, 2, 3, 4, 5)
y <- c(2, 4, 5, 6, 7)
plot(x, y, main = "Some Linear Scatterplot", col = 1,bg = 8, pch = 17, cex = 2)
abline(lm(y ~ x), col = 2, lty = 2, lwd = 2)

6.4 Saving Plots

png("Figure1.png", width = 100, height = 100, units = 'mm', res = 300)
with(PlantGrowth,hist(weight,
      xlim= c(3,7),ylim= c(0,10),col= "lightgray", border= "black", main= "Histogram of Plant Weights",xlab= "Dried weight (g)",ylab= "Frequency"))