ComeçarComece de graça

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.

Este exercício faz parte do curso

Interactive Data Visualization with Bokeh

Ver curso

Instruções do exercício

  • 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.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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(____(____, ____))
Editar e executar o código