Aan de slagGa gratis aan de slag

Size, location, and price

Next, the estate agents would like to understand how price is related to the size of the property and its distance from the Central Business District (CBD).

In this case, the y-axis of both figures will have the same units, so making a row of subplots is an appropriate choice. source has been set up as a Bokeh object using the melb dataset, and preloaded for you.

Deze oefening maakt deel uit van de cursus

Interactive Data Visualization with Bokeh

Cursus bekijken

Oefeninstructies

  • Import row from the associated Bokeh module.
  • Add circle glyphs to both figures, representing "price" on the y-axis versus "building_area" in building_size, and "price" on the y-axis versus "distance" in distance.
  • Update the y-axis of both figures to display in the format of $0a, for millions of dollars.
  • Complete the call of show() to display both subplots.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import row
from ____.____ import ____
building_size = figure(x_axis_label="Building Area (Meters Squared)", y_axis_label="Sales")
distance = figure(x_axis_label="Distance from CBD (km)", y_axis_label="Sales")

# Add circle glyphs
building_size.circle(x="____", y="____", source=____)
distance.circle(x="____", y="____", source=____)

# Update the y-axis format for both figures
building_size.____[____].____ = ____(____="____")
distance.____[____].____ = ____(____="____")

# Display the subplots
output_file(filename="my_first_row.html")
show(____(____, ____))
Code bewerken en uitvoeren