15.071 | Spring 2017 | Graduate

The Analytics Edge

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?

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?

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

As Taught In
Spring 2017
Level
Learning Resource Types
Lecture Videos
Lecture Notes
Problem Sets with Solutions