- High-level graphics
- Custom graphics
- Layered graphics in
`ggplot2`

- High-level graphics
- Custom graphics
- Layered graphics in
`ggplot2`

- The functions
`hist()`

,`boxplot()`

,`plot()`

,`points()`

,`lines()`

,`text()`

,`mtext()`

,`axis()`

, etc. form a suite that plot graphs and add features to the graph - Each of these functions have various options, to learn more about them, use the help
`par()`

can be used to set or query graphical parameters

x = state.x77[ , 2] # 50 average state incomes in 1977 hist(x)

hist(x, breaks = 8, xlab="Income", main="Histogram of State Income in 1977")

y = quakes$depth # 1000 earthquake depths hist(y, seq(0, 700, by = 70), xlab="Earthquake Depth", main="Histogram of Earthquake Depths")

Function `ecdf()`

provides data for empirical cdf

plot.ecdf(x)

Can add vertical lines and remove dots

plot.ecdf(x, verticals = T, pch = "", xlab="Income", main="ECDF of State Income in 1977")

plot.ecdf(y, verticals = T, pch = "", xlab="Earthquake Depth", main="ECDF of Earthquake Depths")

`qqnorm()`

and `qqplot()`

- `qqnorm() plots the quantiles of a data set against the quantiles of a Normal distribution
- `qqplot() plots the quantiles of a first data set against the quantiles of a second data set

`qqnorm()`

and `qqplot()`

qqnorm(x) # qq plot for the earthquake depths qqline(x, col = "red") # red reference line

`qqnorm()`

and `qqplot()`

qqnorm(y) # qq plot for the earthquake depths qqline(y, col = "red") # red reference line

boxplot(count ~ spray, data = InsectSprays)