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
Interactive Data Visualization with Bokeh
Anleitung zur Übung
- Import
gridplot
. - Create
df
by filteringmelb
for the desired region. - Complete the code to add circle glyphs to
fig
, representingx
as the building area column andy
as price, fromsource
, andlegend_label
asregion
. - Display the subplots in a grid using two columns.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# 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=____))