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.
This exercise is part of the course
Interactive Data Visualization with Bokeh
Exercise instructions
- Import
row
from the associated Bokeh module. - Add circle glyphs to both figures, representing
"price"
on the y-axis versus"building_area"
inbuilding_size
, and"price"
on the y-axis versus"distance"
indistance
. - 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.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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(____(____, ____))