Database Reference
In-Depth Information
Figure 3.18 Scatterplot matrix of Fisher's [13] iris dataset
Consider the scatterplot from the first row and third column of Figure 3.18 , where
sepal length is compared against petal length. The horizontal axis is the petal
length, and the vertical axis is the sepal length. The scatterplot shows that
versicolor and virginica share similar sepal and petal lengths, although the latter
has longer petals. The petal lengths of all setosa are about the same, and the petal
lengths are remarkably shorter than the other two species. The scatterplot shows
that for versicolor and virginica , sepal length grows linearly with the petal length.
The R code for generating the scatterplot matrix is provided next.
# define the colors
colors <- c("red", "green", "blue")
# draw the plot matrix
pairs(iris[1:4], main = "Fisher's Iris Dataset",
pch = 21, bg = colors[unclass(iris$Species)] )
# set graphical parameter to clip plotting to the figure
region
par(xpd = TRUE)
# add legend
legend(0.2, 0.02, horiz = TRUE,
as.vector(unique(iris$Species)),
fill = colors, bty = "n")
Search WWH ::




Custom Search