Secondary School Courses Ranked by Enrolment (2011-2012)

Show code
clean_1112 <- read_rds("clean_1112.rds") %>% 
  group_by(Grade) %>% 
  arrange(desc(Enrolment)) %>% 
  slice(1:20)

plot_1112 <- clean_1112 %>% 
  ggplot(aes(x = fct_reorder(as.factor(`Course Code`), desc(Enrolment)),
             y = Enrolment,
             fill = `Pathway or Destination`,
             text = paste("Course Code:", `Course Code`, "\n",
                          "Course Description:", `Course Description`, "\n",
                          "# of Students Enrolled:", Enrolment, "\n",
                          "Pathway/Destination:", `Pathway or Destination`))) +
  geom_col() +
  facet_wrap(~ Grade, scales = "free") +
  scale_y_continuous(labels = scales::comma_format()) +
  scale_x_discrete(labels = NULL, breaks = "", name = "") +
  ylim(0, 180000) +
  labs(title = "Top 20 Secondary School Courses by Number of Students Enrolled (2011-2012)")

plot_1112 %>% 
  ggplotly(tooltip = "text") %>% 
  layout(width = 1000,
         height = 600,
         title = list(y = 0.97,
                      yanchor = "bottom"),
         legend = list(bgcolor = "#FFFFF0",
                       orientation = "v",
                       yanchor = "top",
                       y = 1))