7.3 The Analytical Policeman: Visualization for Law and Order

7.3 The Analytical Policeman: Visualization for Law and Order

Quick Question

Create a new line plot, like the one in Video 3, but add the argument “linetype=2”. So the geom_line part of the plotting command should look like:

geom_line(aes(group=1), linetype=2)

What does this do?

 Makes the line thicker  close
 Changes the color of the line to blue  close
 Makes the line dashed  check
 Makes the line lighter in color  close
Check Show Solution

Explanation The linetype parameter makes the line dashed, and the alpha parameter makes the line lighter in color, or more transparent. The two plots can be generated with the following commands: ggplot(WeekdayCounts, aes(x = Var1, y = Freq)) + geom\_line(aes(group=1), linetype=2) + xlab("Day of the Week") + ylab("Total Motor Vehicle Thefts") ggplot(WeekdayCounts, aes(x = Var1, y = Freq)) + geom\_line(aes(group=1), alpha=0.3) + xlab("Day of the Week") + ylab("Total Motor Vehicle Thefts")

Now, change the alpha parameter to 0.3 by replacing “linetype=2” with “alpha=0.3” in the plot command. What does this do?

 Makes the line thicker  close
 Changes the color of the line to blue  close
 Makes the line dashed  close
 Makes the line lighter in color  check
Check Show Solution

Explanation The linetype parameter makes the line dashed, and the alpha parameter makes the line lighter in color, or more transparent. The two plots can be generated with the following commands: ggplot(WeekdayCounts, aes(x = Var1, y = Freq)) + geom\_line(aes(group=1), linetype=2) + xlab("Day of the Week") + ylab("Total Motor Vehicle Thefts") ggplot(WeekdayCounts, aes(x = Var1, y = Freq)) + geom\_line(aes(group=1), alpha=0.3) + xlab("Day of the Week") + ylab("Total Motor Vehicle Thefts")

Course Info

Learning Resource Types

theaters Lecture Videos
notes Lecture Notes
assignment_turned_in Problem Sets with Solutions