Get startedGet started for free

Categorical column subplots

The estate agents would like you to analyze how property size and amount of land vary by region in Melbourne. With the column layout, you can create two subplots displaying these relationships, using region as the x-axis.

The melb DataFrame has been grouped by region, and the average values for land_area and building_area have been calculated. This has been set up as a Bokeh data object called source, preloaded for you.

This exercise is part of the course

Interactive Data Visualization with Bokeh

View Course

Exercise instructions

  • Import column from the associated Bokeh module.
  • Add bar glyphs to building_size, plotting the "building_area" for each "region".
  • Add bar glyphs to land_size, representing the "land_area" for each "region".
  • Generate an HTML file called "my_first_column.html", and complete the call of show() to display both subplots.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import column
from ____.____ import ____
regions = ["Eastern", "Southern", "Western", "Northern"]
building_size = figure(x_axis_label="Region", y_axis_label="Building Size (Meters Squared)", 
                       x_range=regions)
land_size = figure(x_axis_label="Region", y_axis_label="Land Size (Meters Squared)", 
                   x_range=regions)

# Add bar glyphs
building_size.____(x="____", top="____", source=____)
land_size.____(x="____", top="____", source=____)

# Generate HTML file and display the subplots
output_file(filename="____")
show(____(____, ____))
Edit and Run Code