IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Interactive Data Visualization with Bokeh

Visualizza il corso

Istruzioni dell'esercizio

  • 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().

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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)
Modifica ed esegui il codice