Changing size
The estate agents have fed back that the subplots are quite large! They have asked you to make the next round of visualizations, displaying the relationship between the year a property was built with a) distance from the CBD and b) property size, a bit smaller.
You will manually specify the size of two subplots in row
format.
This exercise is part of the course
Interactive Data Visualization with Bokeh
Exercise instructions
- Set
height
to 300 pixels andwidth
to 400 pixels for bothdistance_vs_year
andbuilding_size_vs_year
. - Add circle glyphs to
distance_vs_year
, withx
being theyear_built
andy
representingdistance
from CBD. - Repeat for
building_size_vs_year
with the same x-axis, but settingy
tobuilding_area
. - Finish the
show()
call to display the subplots in arow
layout.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Set up figures
distance_vs_year = figure(x_axis_label="Year Built", y_axis_label="Distance from CBD (km)", height=____, width=____)
building_size_vs_year = figure(x_axis_label="Year Built", y_axis_label="Building Size (Meters Squared)", height=____, width=____)
# Add circle glyphs to distance_vs_year
distance_vs_year.circle(x="____", y="____", source=____)
# Add circle glyphs to building_size_vs_year
building_size_vs_year.circle(x="____", y="____", source=____)
# Generate HTML file and display plot
output_file(filename="custom_size_plot")
show(____(____, ____))