7.3 The Analytical Policeman: Visualization for Law and Order

Quick Question

In this quick question, we'll ask you questions about the following plots. Plot (1) is the heat map we generated at the end of Video 4. Plot (2) and Plot (3) were generated by changing argument values of the command used to generate Plot (1).

Plot (1) 

Heatmap of total motor vehicle thefts according to time and day in shades of red.

Plot (2)

Alternate heatmap of total motor vehicle thefts according to time and day in shades of red.

Plot (3)

Heatmap of total motor vehicle thefts according to time and day in shades of grey.

Which argument(s) did we change to get Plot (2)? Select all that apply.

Exercise 1

 

Explanation

To get Plot (2), we changed the arguments "x" and "y" (we flipped them). Plot (2) can be generated with the following code:

ggplot(DayHourCounts, aes(x = Var1, y = Hour)) + geom_tile(aes(fill=Freq)) + scale_fill_gradient(name="Total MV Thefts", low="white", high="red") + theme(axis.title.y=element_blank())

Which argument(s) did we change to get Plot (3)? Select all that apply.

Exercise 2

 

Explanation

To get Plot (3), we changed the argument "high" to "black". Plot (3) can be generated with the following code:

ggplot(DayHourCounts, aes(x = Hour, y = Var1)) + geom_tile(aes(fill=Freq)) + scale_fill_gradient(name="Total MV Thefts", low="white", high="black") + theme(axis.title.y=element_blank())