Session Ready
Exercise

Facets 3

In this exercise, you will create a grid with six bar plots for the six age groups in the tb data. You will follow the method used in the previous exercise.

Note that:

  • rbokeh is pre-loaded.
  • tb_split_age is a list variable containing six dataframes corresponding to the six age groups in the tb data and year is a factor variable. Both are available in this session.
Instructions
100 XP
  • Define a function plot_bar() to create a bar plot with the number of tb cases versus time, colored by gender. Use position dodge and make the hover info available.
  • Apply the plot_bar() to the six age groups using lapply().
  • Create a grid plot with the six figure with a width of 600 and height of 900.
  • Distribute the figures in 3 rows and use the same axes range.