Using gridplot
The estate agents would like to examine how the relationship between property size and price varies across the four regions of Melbourne:
"Northern", "Western", "Eastern", and "Southern".
This is a great opportunity to use gridplot, displaying one subplot for each region!
Este exercício faz parte do curso
Interactive Data Visualization with Bokeh
Instruções do exercício
- Import
gridplot. - Create
dfby filteringmelbfor the desired region. - Complete the code to add circle glyphs to
fig, representingxas the building area column andyas price, fromsource, andlegend_labelasregion. - Display the subplots in a grid using two columns.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Import gridplot
from ____.____ import ____
plots = []
# Complete for loop to create plots
for region in ["Northern", "Western", "Southern", "Eastern"]:
df = melb.loc[melb["region"] == ____]
source = ColumnDataSource(data=df)
fig = figure(x_axis_label="Building Area (Meters Squared)", y_axis_label="Price")
fig.circle(x="____", y="____", source=____, legend_label=____)
fig.yaxis[0].formatter = NumeralTickFormatter(format="$0a")
plots.append(fig)
# Display plot
output_file(filename="gridplot.html")
show(____(____, ncols=____))