gridplot का उपयोग
एस्टेट एजेंट यह देखना चाहते हैं कि प्रॉपर्टी के साइज और प्राइस के बीच का संबंध मेलबर्न के चार रीज़न में कैसे बदलता है:
"Northern", "Western", "Eastern", और "Southern".
यह gridplot इस्तेमाल करने का बेहतरीन मौका है, जिसमें हर रीज़न के लिए एक-एक subplot दिखाया जाएगा!
यह अभ्यास पाठ्यक्रम का हिस्सा है
Bokeh के साथ इंटरएक्टिव डेटा विज़ुअलाइज़ेशन
अभ्यास निर्देश
gridplotइम्पोर्ट करें.- इच्छित रीज़न के लिए
melbको फ़िल्टर करकेdfबनाएँ. - कोड पूरा करें ताकि
figमें circle glyphs ऐड हों, जहाँxबिल्डिंग एरिया कॉलम हो औरyप्राइस हो,sourceसे, औरlegend_labelके रूप मेंregionहो. - सबप्लॉट्स को ग्रिड में दो कॉलम का उपयोग करके दिखाएँ.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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=____))