Graphics Programs Reference
In-Depth Information
Now iterate through each row of the data; check if it's above or below and
specify the colors accordingly. The c() directive creates an empty vector,
which you add to in each iteration.
reading_colors <- c()
for (i in 1:length(education$state)) {
if (education$reading[i] > 523) {
col <- “#000000”
} else {
col <- “#cccccc”
}
reading_colors <- c(reading_colors, col)
}
Then pass the reading_colors array into parallel instead of the lone
“#000000” . This gives you Figure 7-24, and it's much easier to see the big
move from high to low.
parallel(education[,2:7], horizontal.axis=FALSE, col=reading_colors)
FIGurE 7-24 States with top reading scores highlighted
Search WWH ::




Custom Search