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!
Diese Übung ist Teil des Kurses
<Kurs>Interactive Data Visualization with Bokeh</Kurs>Übungsanweisungen
- 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.
Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# 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=____))