Dot Plots

Sameer Mathur

Dot Plot

Dot plot of mpg for each car model from the datset mtcars

dotchart(mtcars$mpg,labels=row.names(mtcars),cex=.7,
         main="Gas Mileage for Car Models", 
         xlab="Miles Per Gallon")

Dot Plot

Dot Plot Grouped, Sorted, and Colored

Dot plot of mpg for car models grouped by number of cylinders

x <- mtcars[order(mtcars$mpg),]                      
x$cyl <- factor(x$cyl)                                 
x$color[x$cyl==4] <- "red"                              
x$color[x$cyl==6] <- "blue"
x$color[x$cyl==8] <- "darkgreen" 

Dot Plot Grouped, Sorted, and Colored

dotchart(x$mpg,labels = row.names(x), cex=.7, pch=19, groups = x$cyl, gcolor = "black", color = x$color,
         main = "Gas Mileage for Car Models\ngrouped by cylinder", xlab = "Miles Per Gallon")

Dot Plot Grouped, Sorted, and Colored