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.
Este exercício faz parte do curso
Interactive Data Visualization with Bokeh
Instruções do exercício
- Create
fig, setting thex_rangeby callingFactorRange()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 bygrouped_bakery["sales"], and bar width to 90%. - Update the title font size to
"25px". - Change the format of the title to center alignment.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Create figure
fig = ____
# Create bar glyphs
____
fig.yaxis[0].formatter = NumeralTickFormatter(format="$0,0")
# Update title text size
fig.____.____ = "____"
# Update title alignment
fig.____.____ = "____"
output_file("sales_by_type_of_day.html")
show(fig)