Database Reference
In-Depth Information
Figure 3.14
Dotplot to visualize multiple variables
The barplot in
Figure 3.15
visualizes the distribution of car cylinder counts and
number of gears. The x-axis represents the number of cylinders, and the color
represents the number of gears. The code to generate
Figure 3.15
is shown next.
counts <- table(mtcars$gear, mtcars$cyl)
barplot(counts, main="Distribution of Car Cylinder Counts
and Gears",
xlab="Number of Cylinders", ylab="Counts",
col=c("#0000FFFF", "#0080FFFF", "#00FFFFFF"),
legend = rownames(counts), beside=TRUE,
args.legend = list(x="top", title = "Number of Gears"))