Brook Luers
Teaching    >    Statistics 306, Fall 2017    >    Lab 1

Solution to Lab 1 Exercise

ggplot(grad)+
  geom_line(aes(x=year,y=GradRate, group=SCL_NAME,
                color=SCL_NAME=="University of Michigan-Ann Arbor")) + 
  facet_grid(Gender~Population)+
  scale_color_hue(name="",
                       breaks=c("FALSE","TRUE"),
                       labels=c("Other Big 10 schools","Michigan"))

Here’s a modification to help understand the breaks and labels arguments to scale_color_hue.

ggplot(grad)+
  geom_line(aes(x=year,y=GradRate, group=SCL_NAME,
                color=SCL_NAME=="University of Michigan-Ann Arbor")) + 
  facet_grid(Gender~Population)+
  scale_color_hue(name="",
                       breaks=c(TRUE),
                       labels=c("Michigan"))