BaşlayınÜcretsiz Başlayın

Free throw percentage by position

The agency has asked for one final plot from you. You'll use factor_cmap to build a scatter plot visualizing free throw percentage versus average points, displaying each player position as a different color.

A source object called source has been created from the nba dataset and preloaded for you. The variable TOOLTIPS, containing the name of the player, has also been created, so it can be viewed when hovering the mouse over the plot.

Bu egzersiz

Interactive Data Visualization with Bokeh

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import Category10_5 and factor_cmap.
  • Create positions, a list containing "PG", "SG", "SF", "PF", and "C".
  • Pass "position" to the legend_field argument and complete the fill_color argument within fig.circle().

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import modules
____
____

# Create positions
positions = ["____", "____", "____", "____", "____"]
fig = figure(x_axis_label="Free Throw Percentage", y_axis_label="Points", title="Free Throw Percentage vs. Average Points", tooltips=TOOLTIPS)

# Add circle glyphs
fig.circle(x="free_throw_perc", y="points", source=source, legend_field="____", fill_color=factor_cmap("____", palette=____, factors=____))

output_file(filename="average_points_vs_free_throw_percentage.html")
show(fig)
Kodu Düzenle ve Çalıştır