शुरू करेंमुफ़्त में शुरू करें

Color bar जोड़ना

एजेंसी ने अनुरोध किया है कि आप एक ColorBar शामिल करें ताकि प्लॉट देखने वाले लोग समझ सकें कि किस थ्रेशहोल्ड पर glyph का रंग बदलता है.

पिछले अभ्यास से figure, एक mapper, और glyphs आपके लिए दिए गए हैं.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Bokeh के साथ इंटरएक्टिव डेटा विज़ुअलाइज़ेशन

पाठ्यक्रम देखें

अभ्यास निर्देश

  • ColorBar इंपोर्ट करें.
  • mapper की उपयुक्त key का उपयोग करके color_bar बनाएँ, और चौड़ाई 8 पिक्सेल सेट करें.
  • color_bar को figure के layout में दाएँ पक्ष पर जोड़ें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Import ColorBar
____

mapper = linear_cmap(field_name="assists", palette=RdBu8, low=min(nba["assists"]), high=max(nba["assists"]))
fig = figure(x_axis_label="Steals", y_axis_label="Assists", title="Steals vs. Assists")
fig.circle(x="steals", y="assists", source=source, color=mapper)

# Create the color_bar
color_bar = ____(color_mapper=____, width=____)

# Update layout with color_bar on the right
fig.____(____, "____")
output_file(filename="steals_vs_assists_color_mapped.html")
show(fig)
कोड संपादित करें और चलाएँ