抄截對助攻
代理商聽說了線性顏色對映,想要你把它用在視覺化抄截與助攻的圖上。你將使用線性顏色對映,讓助攻數增加時圖形的顏色隨之改變。
名為 source 的來源物件已由 nba 資料集建立並為你預先載入。
本練習屬於課程
使用 Bokeh 製作互動式資料視覺化
練習說明
- 從各自的類別匯入
RdBu8與linear_cmap。 - 建立
mapper,使用RdBu8隨著"assists"的數值改變而調整顏色。 - 建立一個圖形,標題設為
"Steals vs. Assists"。 - 完成圓形圖元的呼叫,將
mapper加入其中。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import required modules
____
____
# Create mapper
mapper = ____(field_name="____", palette=____, low=____, high=____)
# Create the figure
fig = figure(x_axis_label="Steals", y_axis_label="Assists", title="____")
# Add circle glyphs
fig.circle(x="steals", y="assists", source=source, color=____)
output_file(filename="steals_vs_assists.html")
show(fig)