1. Learn
  2. /
  3. Courses
  4. /
  5. Interactive Data Visualization with Bokeh

Connected

Exercise

Sales by time and type of day

The bakery you are working with is considering a review of their opening hours. As such, they have asked you to produce a visualization displaying sales information by the time of day for weekdays and weekends.

The day_time column of bakery contains four values: "Morning", "Afternoon", "Evening", and "Night".

The dataset also contains "Weekend" and "Weekday" values for the day_type column.

You will produce a grouped bar plot visualizing sales by both time and type of day. FactorRange has been imported for you.

The bakery dataset has been grouped by day_time and day_type, stored as grouped_bakery, and preloaded for you. A tuple containing every variation of these two columns has been stored as factors and also preloaded for you.

Instructions

100 XP
  • Create fig, setting the x_range by calling FactorRange() and passing *factors, assigning "Sales" to the y-axis label, and giving a title of "Sales by type of day".
  • Add bar glyphs for factors, with the top represented by grouped_bakery["sales"], and bar width to 90%.
  • Update the title font size to "25px".
  • Change the format of the title to center alignment.