IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Interactive Data Visualization with Bokeh

Visualizza il corso

Istruzioni dell'esercizio

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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(____(____, ____))
Modifica ed esegui il codice