Chapter 10 Default Dot Plots in R
Formula:
dotchart(x, labels = NULL, groups = NULL, gcolor = par(“fg”), color = par(“fg”))
Simple Dot Plots numeric vectors:
Example-1:
# Simple Dot Plot
dotchart(mtcars$mpg,labels=row.names(mtcars),cex=.7,
main="Gas Milage for Car Models",
xlab="Miles Per Gallon")
Example-2:
# Plot and color by groups cyl
grps <- as.factor(mtcars$cyl)
my_cols <- c("#0776A0", "#FFA100", "#6E0069")
dotchart(mtcars$mpg, labels = row.names(mtcars),
groups = grps, gcolor = my_cols,
color = my_cols[grps],
cex = 0.6, pch = 19, xlab = "mpg")
Dot Plot matrix:
dotchart(VADeaths, cex = 0.6,
main = "Death Rates in Virginia - 1940")